@stacksjs/bunpress 0.2.21 → 0.2.22
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.d.ts +2 -4
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-9ytw3mfw.js → chunk-3z2k0ntf.js} +1 -1
- package/dist/{chunk-3ymfys00.js → chunk-8rsrw3sw.js} +26 -26
- package/dist/{chunk-hz4fjaxv.js → chunk-a68w1rpw.js} +1 -1
- package/dist/chunk-amkb7f82.js +2 -0
- package/dist/{chunk-7jcye3th.js → chunk-m7y4g28p.js} +151 -143
- package/dist/{chunk-rcr6k1et.js → chunk-xjz041s0.js} +2 -2
- package/dist/{chunk-rnzqf7rp.js → chunk-ynp2pgxy.js} +1 -1
- package/dist/chunk-zpf2c5ag.js +393 -0
- package/dist/src/build-output.d.ts +2 -0
- package/dist/src/html-entities.d.ts +7 -0
- package/dist/src/index.js +1 -1
- package/dist/src/markdown-pages.d.ts +22 -0
- package/dist/src/serve.d.ts +4 -7
- package/package.json +1 -1
- package/dist/chunk-yave4hym.js +0 -393
- package/dist/chunk-ynq8k1af.js +0 -2
package/dist/chunk-yave4hym.js
DELETED
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{B as k4,y as C4,z as v4}from"./chunk-rcr6k1et.js";import{D as b4,E as O,G as e,L as L4,M as x4,N as E4,aa as P4,ca as h4}from"./chunk-3ymfys00.js";import{da as F,ea as a}from"./chunk-rnzqf7rp.js";var{Glob:m4}=globalThis.Bun;import{copyFile as L6,mkdir as g4,readdir as x6,rename as E6,rm as K4}from"fs/promises";import{existsSync as S6}from"fs";import{join as D,resolve as F6}from"path";import E from"process";import{CLI as y6}from"@stacksjs/clapp";var p="0.2.21";var{Glob:i4}=globalThis.Bun;import{dirname as s4,relative as r4,resolve as c,sep as N4}from"path";import{mkdir as o4}from"fs/promises";function q4(K){return N4==="/"?K:K.split(N4).join("/")}function t4(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function _4(K,Z,Q){let $=c(K),Y=Q?q4(r4($,c(Q))):void 0,X=[],q=new i4("**/*");for await(let R of q.scan({cwd:$,onlyFiles:!0})){let _=q4(R);if(_===Y)continue;X.push(_)}X.sort((R,_)=>R.localeCompare(_));let N=[],W=new Bun.CryptoHasher("sha256");for(let R of X){let _=new Uint8Array(await Bun.file(c($,R)).arrayBuffer()),G=t4(_);N.push({path:R,bytes:_.byteLength,sha256:G}),W.update(`${R}\x00${_.byteLength}\x00${G}
|
|
3
|
-
`)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:N,tree_sha256:W.digest("hex")}}async function W4(K,Z,Q){let $=await _4(K,Q,Z);return await o4(s4(c(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
|
|
4
|
-
`),$}function H4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function R4(K,Z,Q){let $=await Bun.file(Z).json();if($.schema_version!==1||$.generator!=="bunpress"||!Array.isArray($.outputs))throw Error(`Unsupported or malformed BunPress build manifest: ${Z}`);let Y=await _4(K,Q,Z);if(JSON.stringify(Y)===JSON.stringify($))return Y;let X=H4($),q=H4(Y),N=Y.outputs.filter((G)=>!X.has(G.path)).map((G)=>G.path),W=$.outputs.filter((G)=>!q.has(G.path)).map((G)=>G.path),R=Y.outputs.filter((G)=>{let V=X.get(G.path);return V&&(V.bytes!==G.bytes||V.sha256!==G.sha256)}).map((G)=>{let V=X.get(G.path);return`${G.path} [bytes ${V.bytes} -> ${G.bytes}; sha256 ${V.sha256} -> ${G.sha256}]`}),_=[$.generator_version!==Y.generator_version?`generator ${$.generator_version} -> ${Y.generator_version}`:"",N.length?`added: ${N.join(", ")}`:"",W.length?`removed: ${W.join(", ")}`:"",R.length?`changed: ${R.join(", ")}`:""].filter(Boolean);throw Error(`BunPress output does not match ${Z}: ${_.join("; ")||"tree hash changed"}`)}import{existsSync as e4}from"fs";import{rm as K6}from"fs/promises";import{join as Q6}from"path";var L={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m"};function z(K,Z){return`${L[Z]}${K}${L.reset}`}function T(K){console.log(`${L.green}\u2713${L.reset} ${K}`)}function j(K){console.error(`${L.red}\u2717${L.reset} ${K}`)}function h(K){console.warn(`${L.yellow}\u26A0${L.reset} ${K}`)}function B(K){console.log(`${L.blue}\u2139${L.reset} ${K}`)}function w(K){if(K===0)return"0 B";let Z=1024,Q=["B","KB","MB","GB"],$=Math.floor(Math.log(K)/Math.log(Z));return`${Number.parseFloat((K/Z**$).toFixed(2))} ${Q[$]}`}function i(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var G4=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class v{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(G4){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${L.cyan}${K}${L.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),T(K||this.text)}fail(K){this.stop(),j(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!G4)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function d(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${L.cyan}?${L.reset} ${K} ${L.dim}(${Q})${L.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),Y=new TextDecoder,{value:X}=await $.read(),q=Y.decode(X).trim().toLowerCase();if(!q)return Z;return q==="y"||q==="yes"}function g(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let Y of Z)Q[Y]=Math.max(Y.length,...K.map((X)=>String(X[Y]).length));let $=Z.map((Y)=>Y.padEnd(Q[Y])).join(" ");console.log(z($,"bold")),console.log("\u2500".repeat($.length));for(let Y of K){let X=Z.map((q)=>String(Y[q]).padEnd(Q[q])).join(" ");console.log(X)}}async function l(K){try{return Bun.file(K).size}catch{return 0}}async function Z6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let Y of Q.scan(K)){let X=`${K}/${Y}`,q=await l(X);$+=q}return $}catch{return 0}}async function V4(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=Q6(Q,".bunpress"),Y=K.force||!1,X=K.verbose||!1;try{if(!e4($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await Z6($);if(X)B(`Found "${$}" (${w(N)})`);if(!Y){if(!await d(`Delete "${$}" directory? (${w(N)})`,!1))return B("Clean cancelled"),!1}let W=process.env.VITEST==="true"||!1,R=null;if(!W&&!X)R=new v("Cleaning build artifacts..."),R.start();if(await K6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${w(N)} from "${$}"`);else if(X||W)T(`Cleaned ${w(N)} from "${$}"`);return!0}catch(q){return j(`Failed to clean directory: ${q}`),!1}}import{existsSync as s}from"fs";import{join as r}from"path";async function j4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let Y of Z){let X=r(process.cwd(),Y);if(s(X)){Q=X;break}}if(!Q)return j("No configuration file found"),B('Run "bunpress config init" to create one'),!1;T(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(z("Configuration:","bold")),console.log($),!0}catch(Z){return j(`Failed to show configuration: ${Z}`),!1}}async function A4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let W of Q){let R=r(process.cwd(),W);if(s(R)){$=R;break}}if(!$)return j("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return j("Configuration file does not export a default object"),!1;let q=[],N=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")q.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")q.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))q.push("nav should be an array");else for(let[W,R]of X.nav.entries())if(!R.text||!R.link)q.push(`nav[${W}] is missing required fields (text, link)`)}if(!a(X))N.push("no `url` set: sitemap, RSS, canonical links and Open Graph tags are all skipped without an absolute base URL");if(q.length>0){j("Configuration validation failed:");for(let W of q)console.log(` \u2022 ${W}`);return!1}for(let W of N)h(W);return T("Configuration is valid \u2713"),!0}catch(Q){return j(`Failed to validate configuration: ${Q}`),!1}}async function J4(K={}){let Z=r(process.cwd(),"bunpress.config.ts");if(s(Z))return j("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
verbose: false,
|
|
8
|
-
|
|
9
|
-
markdown: {
|
|
10
|
-
toc: {
|
|
11
|
-
enabled: true,
|
|
12
|
-
position: 'sidebar',
|
|
13
|
-
minDepth: 2,
|
|
14
|
-
maxDepth: 3,
|
|
15
|
-
},
|
|
16
|
-
features: {
|
|
17
|
-
inlineFormatting: true,
|
|
18
|
-
containers: true,
|
|
19
|
-
githubAlerts: true,
|
|
20
|
-
codeBlocks: {
|
|
21
|
-
lineNumbers: true,
|
|
22
|
-
lineHighlighting: true,
|
|
23
|
-
focus: true,
|
|
24
|
-
diff: true,
|
|
25
|
-
errorWarning: true,
|
|
26
|
-
},
|
|
27
|
-
codeGroups: true,
|
|
28
|
-
codeImports: true,
|
|
29
|
-
inlineToc: true,
|
|
30
|
-
customAnchors: true,
|
|
31
|
-
emoji: true,
|
|
32
|
-
badges: true,
|
|
33
|
-
includes: true,
|
|
34
|
-
externalLinks: {
|
|
35
|
-
enabled: true,
|
|
36
|
-
openInNewTab: true,
|
|
37
|
-
addIcon: true,
|
|
38
|
-
},
|
|
39
|
-
imageLazyLoading: true,
|
|
40
|
-
tables: {
|
|
41
|
-
responsive: true,
|
|
42
|
-
striped: true,
|
|
43
|
-
hover: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
nav: [
|
|
49
|
-
{ text: 'Home', link: '/' },
|
|
50
|
-
{ text: 'Guide', link: '/guide/' },
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
sitemap: {
|
|
54
|
-
hostname: 'https://example.com',
|
|
55
|
-
},
|
|
56
|
-
} satisfies BunPressConfig
|
|
57
|
-
`;try{return await Bun.write(Z,Q),T(`Created ${Z}`),!0}catch($){return j(`Failed to create configuration: ${$}`),!1}}import{existsSync as k}from"fs";import{join as P}from"path";function M4(){let Z=["bunpress","docs"].flatMap(($)=>[`${$}.config`,`.${$}.config`,$,`.${$}`]),Q=[".ts",".js",".mjs",".cjs",".json"];return Z.flatMap(($)=>Q.map((Y)=>`${$}${Y}`))}async function U4(K={}){let Z=K.verbose||!1,Q=[];console.log(z(`
|
|
58
|
-
Running diagnostics...
|
|
59
|
-
`,"bold")),Q.push({name:"Bun Runtime",status:"pass",message:`v${Bun.version}`});let $=M4().find((H)=>k(P(process.cwd(),H)));if($)Q.push({name:"Configuration",status:"pass",message:$});else Q.push({name:"Configuration",status:"pass",message:"using defaults (no config file)",detail:`Looked for: ${M4().join(", ")}`});let Y=K.dir||O.docsDir||"./docs",X=P(process.cwd(),Y);if(k(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),S=new H("**/*.md"),x=0;for await(let J of S.scan(X))x++;Q.push({name:"Documentation",status:x>0?"pass":"warn",message:`${x} markdown files in ${Y}`,fix:x>0?void 0:`Add a .md file under ${Y}, or run "bunpress new index"`})}else Q.push({name:"Documentation",status:"fail",message:`${Y} not found`,fix:'Run "bunpress init" to create the docs directory',detail:`Resolved from ${K.dir?"--dir":O.docsDir?"config docsDir":"the default"}`});let q=P(process.cwd(),"package.json");if(k(q)){let H=await Bun.file(q).json(),S=H.scripts?.dev,x=H.scripts?.build;Q.push({name:"Package Scripts",status:S&&x?"pass":"warn",message:`dev: ${S?"\u2713":"\u2717"}, build: ${x?"\u2713":"\u2717"}`,fix:S&&x?void 0:'Add "dev": "bunpress dev" and "build": "bunpress build" to package.json scripts'});let J=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];if(H.name==="@stacksjs/bunpress"||k(P(process.cwd(),"packages","bunpress","package.json")))Q.push({name:"BunPress Package",status:"pass",message:"this is the BunPress source repository"});else Q.push({name:"BunPress Package",status:J?"pass":"warn",message:J||"not declared in package.json",fix:J?void 0:'Run "bun add -d @stacksjs/bunpress"'})}else Q.push({name:"Package.json",status:"warn",message:"Not found",fix:'Run "bun init" to create one'});let N=P(process.cwd(),"node_modules");if(k(N))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found",fix:'Run "bun install"'});let W=P(process.cwd(),".git");if(k(W))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized",fix:'Run "git init" \u2014 without it, "last updated" falls back to file timestamps'});let R=P(process.cwd(),"tsconfig.json");if(k(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found",fix:"Only needed for a TypeScript config file \u2014 safe to ignore otherwise"});for(let H of Q){let S=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",x=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";if(console.log(` ${z(S,x)} ${H.name}: ${z(H.message,"dim")}`),Z&&H.detail)console.log(` ${z(H.detail,"dim")}`)}console.log();let _=Q.filter((H)=>H.status==="pass").length,G=Q.filter((H)=>H.status==="fail").length,V=Q.filter((H)=>H.status==="warn").length,U=Q.filter((H)=>H.status!=="pass"&&H.fix);if(U.length>0){B("Recommended actions:");for(let H of U)console.log(` \u2022 ${H.fix}`);console.log()}if(G>0)return j(`${G} checks failed, ${V} warnings`),!1;if(V>0)return h(`${_} checks passed, ${V} warnings`),!0;return T(`All ${_} checks passed!`),!0}import{mkdir as o}from"fs/promises";var $6=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
verbose: false,
|
|
63
|
-
|
|
64
|
-
markdown: {
|
|
65
|
-
toc: {
|
|
66
|
-
enabled: true,
|
|
67
|
-
position: 'sidebar',
|
|
68
|
-
minDepth: 2,
|
|
69
|
-
maxDepth: 3,
|
|
70
|
-
},
|
|
71
|
-
features: {
|
|
72
|
-
inlineFormatting: true,
|
|
73
|
-
containers: true,
|
|
74
|
-
githubAlerts: true,
|
|
75
|
-
codeBlocks: {
|
|
76
|
-
lineNumbers: true,
|
|
77
|
-
lineHighlighting: true,
|
|
78
|
-
focus: true,
|
|
79
|
-
diff: true,
|
|
80
|
-
errorWarning: true,
|
|
81
|
-
},
|
|
82
|
-
codeGroups: true,
|
|
83
|
-
codeImports: true,
|
|
84
|
-
inlineToc: true,
|
|
85
|
-
customAnchors: true,
|
|
86
|
-
emoji: true,
|
|
87
|
-
badges: true,
|
|
88
|
-
includes: true,
|
|
89
|
-
externalLinks: {
|
|
90
|
-
enabled: true,
|
|
91
|
-
openInNewTab: true,
|
|
92
|
-
addIcon: true,
|
|
93
|
-
},
|
|
94
|
-
imageLazyLoading: true,
|
|
95
|
-
tables: {
|
|
96
|
-
responsive: true,
|
|
97
|
-
striped: true,
|
|
98
|
-
hover: true,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
nav: [
|
|
104
|
-
{ text: 'Home', link: '/' },
|
|
105
|
-
{ text: 'Guide', link: '/guide/' },
|
|
106
|
-
{ text: 'GitHub', link: 'https://github.com/stacksjs/bunpress' },
|
|
107
|
-
],
|
|
108
|
-
|
|
109
|
-
sitemap: {
|
|
110
|
-
hostname: 'https://example.com',
|
|
111
|
-
},
|
|
112
|
-
} satisfies BunPressConfig
|
|
113
|
-
`,X6=`---
|
|
114
|
-
layout: home
|
|
115
|
-
title: Welcome to My Documentation
|
|
116
|
-
|
|
117
|
-
hero:
|
|
118
|
-
name: My Project
|
|
119
|
-
text: Modern documentation made easy
|
|
120
|
-
tagline: Fast, flexible, and beautiful documentation powered by BunPress
|
|
121
|
-
actions:
|
|
122
|
-
- theme: brand
|
|
123
|
-
text: Get Started
|
|
124
|
-
link: /guide/
|
|
125
|
-
- theme: alt
|
|
126
|
-
text: View on GitHub
|
|
127
|
-
link: https://github.com/yourusername/your-repo
|
|
128
|
-
|
|
129
|
-
features:
|
|
130
|
-
- icon: \u26A1
|
|
131
|
-
title: Lightning Fast
|
|
132
|
-
details: Powered by Bun runtime for incredible build and dev server performance
|
|
133
|
-
- icon: \uD83C\uDFA8
|
|
134
|
-
title: Beautiful by Default
|
|
135
|
-
details: Clean, modern design with dark mode support out of the box
|
|
136
|
-
- icon: \uD83D\uDCDD
|
|
137
|
-
title: Markdown Enhanced
|
|
138
|
-
details: Extended markdown features including containers, code groups, and more
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
# Welcome
|
|
142
|
-
|
|
143
|
-
This is your new BunPress documentation site. Start editing files in the \`docs/\` directory to customize your content.
|
|
144
|
-
`,Y6=`# Getting Started
|
|
145
|
-
|
|
146
|
-
Welcome to the getting started guide!
|
|
147
|
-
|
|
148
|
-
## Installation
|
|
149
|
-
|
|
150
|
-
\`\`\`bash
|
|
151
|
-
bun install @stacksjs/bunpress
|
|
152
|
-
\`\`\`
|
|
153
|
-
|
|
154
|
-
## Quick Start
|
|
155
|
-
|
|
156
|
-
Create your first documentation page:
|
|
157
|
-
|
|
158
|
-
\`\`\`bash
|
|
159
|
-
bunpress new my-page
|
|
160
|
-
\`\`\`
|
|
161
|
-
|
|
162
|
-
## Next Steps
|
|
163
|
-
|
|
164
|
-
::: tip
|
|
165
|
-
Check out the [markdown extensions](/guide/markdown) to learn about all the powerful features available.
|
|
166
|
-
:::
|
|
167
|
-
|
|
168
|
-
- Learn about [configuration](/guide/configuration)
|
|
169
|
-
- Explore [advanced features](/guide/advanced)
|
|
170
|
-
- Read the [API reference](/api/)
|
|
171
|
-
`,N6=`node_modules/
|
|
172
|
-
dist/
|
|
173
|
-
.DS_Store
|
|
174
|
-
*.log
|
|
175
|
-
.env
|
|
176
|
-
.env.*
|
|
177
|
-
!.env.example
|
|
178
|
-
`,q6=`# My BunPress Documentation
|
|
179
|
-
|
|
180
|
-
Documentation powered by [BunPress](https://github.com/stacksjs/bunpress).
|
|
181
|
-
|
|
182
|
-
## Development
|
|
183
|
-
|
|
184
|
-
Start the dev server:
|
|
185
|
-
|
|
186
|
-
\`\`\`bash
|
|
187
|
-
bun run dev
|
|
188
|
-
\`\`\`
|
|
189
|
-
|
|
190
|
-
## Build
|
|
191
|
-
|
|
192
|
-
Build the documentation:
|
|
193
|
-
|
|
194
|
-
\`\`\`bash
|
|
195
|
-
bun run build
|
|
196
|
-
\`\`\`
|
|
197
|
-
|
|
198
|
-
## Preview
|
|
199
|
-
|
|
200
|
-
Preview the built site:
|
|
201
|
-
|
|
202
|
-
\`\`\`bash
|
|
203
|
-
bun run preview
|
|
204
|
-
\`\`\`
|
|
205
|
-
`;async function B4(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await d("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new v("Initializing BunPress project...");Q.start(),await o("./docs",{recursive:!0}),await o("./docs/guide",{recursive:!0}),await o("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",$6),await Bun.write("./docs/index.md",X6),await Bun.write("./docs/guide/index.md",Y6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",N6);let Y=await Bun.file("./README.md").exists();if(!Y)await Bun.write("./README.md",q6);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(),T("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(!Y)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 j(`Failed to initialize project: ${Z}`),!1}}import{mkdir as H6}from"fs/promises";import{dirname as _6,join as W6}from"path";var T4={default:(K)=>`---
|
|
206
|
-
title: ${K}
|
|
207
|
-
description:
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
# ${K}
|
|
211
|
-
|
|
212
|
-
Your content goes here...
|
|
213
|
-
`,guide:(K)=>`---
|
|
214
|
-
title: ${K}
|
|
215
|
-
description: ${K} guide
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
# ${K}
|
|
219
|
-
|
|
220
|
-
## Introduction
|
|
221
|
-
|
|
222
|
-
Brief introduction to the topic.
|
|
223
|
-
|
|
224
|
-
## Getting Started
|
|
225
|
-
|
|
226
|
-
Step-by-step instructions.
|
|
227
|
-
|
|
228
|
-
## Examples
|
|
229
|
-
|
|
230
|
-
\`\`\`typescript
|
|
231
|
-
// Example code
|
|
232
|
-
\`\`\`
|
|
233
|
-
|
|
234
|
-
## Next Steps
|
|
235
|
-
|
|
236
|
-
- [ ] Task 1
|
|
237
|
-
- [ ] Task 2
|
|
238
|
-
`,api:(K)=>`---
|
|
239
|
-
title: ${K}
|
|
240
|
-
description: API reference for ${K}
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
# ${K}
|
|
244
|
-
|
|
245
|
-
## Overview
|
|
246
|
-
|
|
247
|
-
Brief overview of the API.
|
|
248
|
-
|
|
249
|
-
## Methods
|
|
250
|
-
|
|
251
|
-
### \`methodName()\`
|
|
252
|
-
|
|
253
|
-
Description of the method.
|
|
254
|
-
|
|
255
|
-
**Parameters:**
|
|
256
|
-
|
|
257
|
-
- \`param1\` (\`type\`) - Description
|
|
258
|
-
|
|
259
|
-
**Returns:**
|
|
260
|
-
|
|
261
|
-
- \`ReturnType\` - Description
|
|
262
|
-
|
|
263
|
-
**Example:**
|
|
264
|
-
|
|
265
|
-
\`\`\`typescript
|
|
266
|
-
// Example usage
|
|
267
|
-
\`\`\`
|
|
268
|
-
`,blog:(K)=>`---
|
|
269
|
-
title: ${K}
|
|
270
|
-
description:
|
|
271
|
-
date: ${new Date().toISOString().split("T")[0]}
|
|
272
|
-
author:
|
|
273
|
-
tags: []
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
# ${K}
|
|
277
|
-
|
|
278
|
-
Post content goes here...
|
|
279
|
-
|
|
280
|
-
## Section 1
|
|
281
|
-
|
|
282
|
-
Content...
|
|
283
|
-
`};async function z4(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=W6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return j(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(" ");let q=Z.template||"default",N=T4[q];if(!N)return j(`Unknown template: ${q}`),j(`Available templates: ${Object.keys(T4).join(", ")}`),!1;let W=N(X),R=_6($);return await H6(R,{recursive:!0}),await Bun.write($,W),T(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${q}`),console.log(` Path: ${$}`),!0}catch(Q){return j(`Failed to create file: ${Q}`),!1}}import{join as n}from"path";async function O4(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",Y=n($,".bunpress"),X=K.verbose||!1;try{let{stat:q}=await import("fs/promises");try{if(!(await q(Y)).isDirectory())j(`"${Y}" is not a directory.`),j('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{j(`Build directory "${Y}" not found.`),j('Run "bunpress build" first to generate the documentation.'),process.exit(1)}B(`Starting preview server from ${Y}`);try{let N=Bun.serve({port:Z,fetch:async(W)=>{let _=new URL(W.url).pathname;if(_.startsWith("/"))_=_.slice(1);if(_===""||_==="/")_="index.html";let G=[_,`${_}.html`,n(_,"index.html")];for(let U of G){let H=Bun.file(n(Y,U));if(await H.exists())return new Response(H,{headers:{"Content-Type":R6(U)}})}let V=Bun.file(n(Y,"404.html"));if(await V.exists())return new Response(V,{status:404,headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});T(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
|
|
284
|
-
`),await new Promise(()=>{})}catch(N){if(N.message?.includes("EADDRINUSE")||N.code==="EADDRINUSE")j(`Port ${Z} is already in use.`),j("Try running with a different port: bunpress preview --port <port>"),j(`Or stop any processes using port ${Z}`);else j(`Failed to start server: ${N.message||N}`);process.exit(1)}}catch(q){j(`Failed to start preview server: ${q}`),process.exit(1)}}function R6(K){let Z=K.split(".").pop()?.toLowerCase();return{html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"application/javascript; charset=utf-8",mjs:"application/javascript; charset=utf-8",json:"application/json; charset=utf-8",map:"application/json; charset=utf-8",xml:"application/xml; charset=utf-8",txt:"text/plain; charset=utf-8",webmanifest:"application/manifest+json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject"}[Z||""]||"application/octet-stream"}import*as b from"fs";import*as y from"path";var{YAML:S4}=globalThis.Bun;async function F4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(B("\uD83D\uDD0D Running SEO checks..."),console.log(""),!b.existsSync(Q))j(`Documentation directory not found: ${Q}`),process.exit(1);let Y={totalPages:0,errors:[],warnings:[],passed:0},X=await A6(Q);Y.totalPages=X.length;for(let q of X)await G6(q,Q,Y,$);if(V6(Z,Q,Y),z6(Y),Y.errors.length>0)process.exit(1)}async function G6(K,Z,Q,$){let Y=await b.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:q}=J6(Y),N=y.relative(Z,K),W=!1,R=$&&Object.keys(X).length>0,_={...X},G=X.layout==="home"?X.hero?.text||X.hero?.name:void 0;if(!X.title&&G);else if(!X.title){let H=M6(q);if(!H)Q.errors.push({type:"error",category:"Title",file:N,message:"Missing title in frontmatter"}),W=!0;else if($)_.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}")`}),W=!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)`}),W=!0;else if(H<10)Q.warnings.push({type:"warning",category:"Title",file:N,message:`Title too short (${H} chars, recommended >10)`}),W=!0}if(!X.description){let H=U6(q);if($)_.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"}),W=!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)`}),W=!0;else if(H<50)Q.warnings.push({type:"warning",category:"Description",file:N,message:`Description too short (${H} chars, recommended >50)`}),W=!0}let V=B6(q,Z,K);for(let H of V)Q.errors.push({type:"error",category:"Links",file:N,message:`Broken internal link: ${H}`}),W=!0;let U=T6(q);for(let H of U)Q.warnings.push({type:"warning",category:"Images",file:N,message:`Image missing alt text: ${H}`}),W=!0;if(R){let H=j6(_,q);await b.promises.writeFile(K,H,"utf-8")}if(!W)Q.passed++}function V6(K,Z,Q){let $=new Set,Y=(N,W)=>{if(typeof N!=="string"||!N.startsWith("/"))return;let R=`${W}:${N}`;if($.has(R))return;$.add(R);let[_,G]=N.split("#"),V=y4(y.resolve(Z,`.${_}`));if(!V){Q.errors.push({type:"error",category:"Links",file:W,message:`Broken link: ${N}`});return}if(G&&!t(V).has(G))Q.errors.push({type:"error",category:"Links",file:W,message:`Broken anchor: ${N}`})},X=(N,W)=>{if(!Array.isArray(N))return;for(let R of N){if(!R||typeof R!=="object")continue;let _=R;Y(_.link,W),X(_.items,W)}};X(K.nav,"config nav"),X(K.themeConfig?.nav,"themeConfig nav");let q=[[K.markdown?.sidebar,"config sidebar"],[K.themeConfig?.sidebar,"themeConfig sidebar"]];for(let[N,W]of q)if(Array.isArray(N))X(N,W);else if(N&&typeof N==="object")for(let[R,_]of Object.entries(N))X(_,`${W} ${R}`)}function j6(K,Z){return`---
|
|
285
|
-
${S4.stringify(K,null,2)}
|
|
286
|
-
---
|
|
287
|
-
${Z}`}async function A6(K){let Z=[];async function Q($){let Y=await b.promises.readdir($,{withFileTypes:!0});for(let X of Y){let q=y.join($,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(q)}else if(X.isFile()&&X.name.endsWith(".md"))Z.push(q)}}return await Q(K),Z}function J6(K){let Z=/^---\n([\s\S]*?)\n---\n?/,Q=K.match(Z);if(!Q)return{frontmatter:{},markdown:K};let $=Q[1],Y=K.slice(Q[0].length);try{return{frontmatter:S4.parse($),markdown:Y}}catch{return{frontmatter:{},markdown:K}}}function M6(K){let Z=K.match(/^#\s+(.+)$/m);return Z?Z[1].trim():null}function U6(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(`
|
|
288
|
-
|
|
289
|
-
`)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function B6(K,Z,Q){let $=[],Y=/\[([^\]]+)\]\(([^)]+)\)/g,X=e(K).replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),q;while((q=Y.exec(X))!==null){let N=q[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(N))continue;let W=N.includes("#")?N.slice(N.indexOf("#")+1):"";if(N.startsWith("#")){if(W&&!t(Q).has(W))$.push(N);continue}let R=N.split("#",1)[0].split("?",1)[0];if(!R)continue;let _;try{_=decodeURIComponent(R.replace(/^<|>$/g,""))}catch{$.push(N);continue}let G=_.startsWith("/")?y.resolve(Z,`.${_}`):y.resolve(y.dirname(Q),_),V=y4(G);if(!V){$.push(N);continue}if(W&&!t(V).has(W))$.push(N)}return $}function y4(K){let Z=K.endsWith(".md")?[K]:[K,`${K}.md`,y.join(K,"index.md")];for(let Q of Z)try{if(b.statSync(Q).isFile())return Q}catch{}return null}var I4=new Map;function t(K){let Z=I4.get(K);if(Z)return Z;let Q=new Set;try{let $=e(b.readFileSync(K,"utf8"));for(let Y of $.split(`
|
|
290
|
-
`)){let X=Y.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let q=X[1].trim(),N=q.match(/\{#([\w-]+)\}\s*$/),W=N?N[1]:x4(L4(q));if(!W)continue;E4(W,Q)}}catch{}return I4.set(K,Q),Q}function T6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let Y=$[1],X=$[2];if(!Y||Y.trim()==="")Z.push(X)}return Z}function z6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${z(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${z(K.passed.toString(),"green")}`),console.log(`Errors: ${z(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${z(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){j(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.warnings.length>0){h(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)T("\u2713 All SEO checks passed!");else if(K.errors.length===0)T("\u2713 No errors found (only warnings)")}import{join as O6}from"path";async function I6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
|
|
291
|
-
`),$=0,Y=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){Y=!Y;continue}if(!Y)X.push(R)}$=X.join(" ").split(/\s+/).filter((R)=>R.length>0).length;let N=Q.filter((R)=>R.match(/^#{1,6}\s+/)).length,W=(Z.match(/```/g)||[]).length/2;return{path:K,size:await l(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(W)}}async function D4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(z(`
|
|
292
|
-
Analyzing documentation...
|
|
293
|
-
`,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),q=[];for await(let J of X.scan(Q)){let A=O6(Q,J),f=await I6(A);q.push(f)}if(q.length===0)return j("No markdown files found"),!1;let N=q.reduce((J,A)=>J+A.size,0),W=q.reduce((J,A)=>J+A.lines,0),R=q.reduce((J,A)=>J+A.words,0),_=q.reduce((J,A)=>J+A.headings,0),G=q.reduce((J,A)=>J+A.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${q.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${_}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let J=q.map((A)=>({File:A.path.replace(`${Q}/`,""),Size:w(A.size),Lines:A.lines,Words:A.words,Headings:A.headings,"Code Blocks":A.codeBlocks}));g(J),console.log()}let V=N/q.length,U=W/q.length,H=R/q.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${w(V)}`),console.log(`Lines: ${Math.round(U)}`),console.log(`Words: ${Math.round(H)}`),console.log();let S=[...q].sort((J,A)=>A.size-J.size).slice(0,5);if(S.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let J of S){let A=J.path.replace(`${Q}/`,"");console.log(` ${A.padEnd(40)} ${w(J.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return j(`Failed to generate statistics: ${Y}`),!1}}var I=new y6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function f4(K){let Z=new m4("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function D6(K,Z,Q=!1){let $=`${Z}/public`;try{await x6($);let Y=new m4("**/*");for await(let X of Y.scan($)){let q=D($,X),N=D(K,X);await g4(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await L6(q,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}function w6(K,Z,Q){let $=Z.replace(/^\.\//,""),Y=(_)=>_.replace(/^\.\//,"").replace($,"").replace(/^\//,"").replace(/\.md$/,"");if(!Q.enabled)return K.map((_)=>({sourceFile:_,relativePath:Y(_),locale:Q.defaultLocale}));let X=Q.locales,q=new Set(X),N=new Map;for(let _ of X)N.set(_,new Map);let W=new Set;for(let _ of K){let G=Y(_),V=G.split("/");if(V.length>1&&q.has(V[0])&&V[0]!==Q.defaultLocale){let H=V.slice(1).join("/");N.get(V[0]).set(H,_),W.add(H);continue}let U=G.match(/^(.*)\.([A-Za-z-]+)$/);if(U&&q.has(U[2])){N.get(U[2]).set(U[1],_),W.add(U[1]);continue}N.get(Q.defaultLocale).set(G,_),W.add(G)}let R=[];for(let _ of X)for(let G of W){let V=N.get(_).get(G)??N.get(Q.defaultLocale).get(G);if(!V)continue;R.push({sourceFile:V,relativePath:G,locale:_})}return R}async function b6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await h4(K,Q);if(await Bun.write(D(Z,P4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function C6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&a(Q))await k4(K,Z,Q);if(Q.robots?.enabled!==!1)await v4(Z,Q);if(Q.rss?.enabled)await C4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function v6(K={}){let Z=await O;if(!K.config)return Z;let Q=F6(E.cwd(),K.config);if(!S6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return b4({...Z,...Y})}async function w4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await v6(K),Q=K.outdir||Z.outDir||M.outdir,$=D(Q,".bunpress"),Y=`${$}.tmp-${E.pid}`,X=K.dir||Z.docsDir||M.docsdir,q=K.verbose??M.verbose,N=K.minify??!1,W=K.sourcemap??!1,R=performance.now(),_=new v("Building documentation...");if(!q)_.start();await K4(Y,{recursive:!0,force:!0}),await g4(Y,{recursive:!0});let G=await f4(X);if(G.length===0){if(!q)_.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(q)console.log(`Found ${G.length} markdown files:`),G.forEach((V)=>console.log(`- ${V}`));try{let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-ynq8k1af.js"),{loadI18nTranslations:H,resolveI18nConfig:S}=await import("./chunk-9ytw3mfw.js"),{mkdir:x,writeFile:J}=await import("fs/promises"),A=await H(S(Z),Z);if(q)console.log("Transforming markdown to HTML...");let f=w6(G,X,A);for(let C of f){let u4=await Bun.file(C.sourceFile).text(),{html:p4,frontmatter:$4}=await V(u4,X),m=C.relativePath,c4=`/${m}`,d4=$4.layout||"doc",l4=await U(p4,Z,c4,d4,$4,{i18n:A,locale:C.locale,sourceFile:C.sourceFile,docsDir:X}),a4=m==="index"||m.endsWith("/index"),X4=C.locale&&C.locale!==A.defaultLocale&&A.enabled?D(Y,C.locale):Y,u=a4?D(X4,`${m}.html`):D(X4,m,"index.html"),Y4=u.substring(0,u.lastIndexOf("/"));if(Y4)await x(Y4,{recursive:!0});if(await J(u,l4),q)console.log(`Generated: ${u}`)}if(q)console.log(`Processed ${G.length} markdown files into ${f.length} pages.`);if(await D6(Y,X,q),await P6(Y),await k6(Y,Z),K.searchIndex!==!1)await b6(X,Y,Z,q||!1);if(await C6(X,Y,Z,q||!1),K.checkManifest)await R4(Y,K.checkManifest,p);if(await K4($,{recursive:!0,force:!0}),await E6(Y,$),K.manifest)await W4($,K.manifest,p);let Z4=performance.now()-R;if(!q)_.succeed(`Built ${G.length} pages to HTML in ${i(Z4)}`);else T(`Build completed in ${i(Z4)}`),console.log(`
|
|
294
|
-
Generated ${G.length} HTML files in ${$}`);return!0}catch(V){if(await K4(Y,{recursive:!0,force:!0}),!q)_.fail("Build failed");return console.error("Error during build:",V),!1}}async function k6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-ynq8k1af.js"),X=`
|
|
295
|
-
<style>
|
|
296
|
-
.NotFound {
|
|
297
|
-
padding: 64px 24px 96px;
|
|
298
|
-
text-align: center;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
@media (min-width: 768px) {
|
|
302
|
-
.NotFound {
|
|
303
|
-
padding: 96px 32px 168px;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.NotFound .code {
|
|
308
|
-
line-height: 64px;
|
|
309
|
-
font-size: 64px;
|
|
310
|
-
font-weight: 600;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.NotFound .title {
|
|
314
|
-
padding-top: 12px;
|
|
315
|
-
letter-spacing: 2px;
|
|
316
|
-
line-height: 20px;
|
|
317
|
-
font-size: 20px;
|
|
318
|
-
font-weight: 700;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.NotFound .divider {
|
|
322
|
-
margin: 24px auto 18px;
|
|
323
|
-
width: 64px;
|
|
324
|
-
height: 1px;
|
|
325
|
-
background-color: var(--vp-c-divider);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.NotFound .quote {
|
|
329
|
-
margin: 0 auto;
|
|
330
|
-
max-width: 256px;
|
|
331
|
-
font-size: 14px;
|
|
332
|
-
font-weight: 500;
|
|
333
|
-
color: var(--vp-c-text-2);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.NotFound .action {
|
|
337
|
-
padding-top: 20px;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.NotFound .link {
|
|
341
|
-
display: inline-block;
|
|
342
|
-
border: 1px solid var(--vp-c-brand-1);
|
|
343
|
-
border-radius: 16px;
|
|
344
|
-
padding: 3px 16px;
|
|
345
|
-
font-size: 14px;
|
|
346
|
-
font-weight: 500;
|
|
347
|
-
color: var(--vp-c-brand-1);
|
|
348
|
-
transition: border-color 0.25s, color 0.25s;
|
|
349
|
-
text-decoration: none;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.NotFound .link:hover {
|
|
353
|
-
border-color: var(--vp-c-brand-2);
|
|
354
|
-
color: var(--vp-c-brand-2);
|
|
355
|
-
}
|
|
356
|
-
</style>
|
|
357
|
-
|
|
358
|
-
<div class="NotFound">
|
|
359
|
-
<p class="code">404</p>
|
|
360
|
-
<h1 class="title">PAGE NOT FOUND</h1>
|
|
361
|
-
<div class="divider"></div>
|
|
362
|
-
<blockquote class="quote">
|
|
363
|
-
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
364
|
-
</blockquote>
|
|
365
|
-
<div class="action">
|
|
366
|
-
<a class="link" href="${`${Q(Z)}/`}" aria-label="go to home">
|
|
367
|
-
Take me home
|
|
368
|
-
</a>
|
|
369
|
-
</div>
|
|
370
|
-
</div>
|
|
371
|
-
`,q=await $(X,Z,"/404","doc");await Bun.write(D(K,"404.html"),q)}async function P6(K){let Z=D(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)}}I.command("build","Build the documentation site").option("--outdir <outdir>","Output directory").option("--dir <dir>","Documentation directory").option("--config <config>","Path to config file").option("--minify","Minify output files",{default:!1}).option("--sourcemap","Generate source maps",{default:!1}).option("--manifest <path>","Write a deterministic rendered-tree manifest").option("--check-manifest <path>","Fail unless the rendered tree matches a checked manifest").option("--search-index","Write the client search index (on by default; --no-search-index skips it)",{default:!0}).option("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await w4(K))E.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,Y=K.dir||$.docsDir||"./docs";console.log(`
|
|
372
|
-
Watching for changes...`),Q(Y,{recursive:!0},async(X,q)=>{if(q&&q.endsWith(".md"))console.log(`
|
|
373
|
-
Detected change in ${q}, rebuilding...`),await w4(K)}),await new Promise(()=>{})}});I.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:M.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:M.watch}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{let Z=await O,Q=K.port||M.port,$=K.dir||Z.docsDir||M.docsdir,Y=K.watch??M.watch,X=K.verbose??M.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:Y,verbose:X});let{serveCLI:q}=await import("./chunk-ynq8k1af.js");await q({port:Q,root:$,watch:Y,config:Z})});async function h6(K={}){let Z=await O,Q=K.dir||Z.docsDir||M.docsdir,$=K.output||"./docs.md",Y=K.full??!1,X=K.verbose??M.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${Y}`);let q=await f4(Q);if(q.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${q.length} markdown files`);q.sort();let N=`# Documentation
|
|
374
|
-
|
|
375
|
-
`;N+=`Generated: ${new Date().toISOString()}
|
|
376
|
-
|
|
377
|
-
`,N+=`Total files: ${q.length}
|
|
378
|
-
|
|
379
|
-
`,N+=`---
|
|
380
|
-
|
|
381
|
-
`;for(let W of q){let R=W.replace(`${Q}/`,""),_=await Bun.file(W).text();if(X)console.log(`Processing: ${R}`);if(N+=`## File: ${R}
|
|
382
|
-
|
|
383
|
-
`,Y)N+=_,N+=`
|
|
384
|
-
|
|
385
|
-
`;else{let G=_.split(`
|
|
386
|
-
`),V=!1,U="";for(let H of G){if(H.trim()==="---")if(!V){V=!0;continue}else{if(V=!1,U)N+="**Frontmatter:**\n```yaml\n",N+=U,N+="```\n\n",U="";continue}if(V){U+=`${H}
|
|
387
|
-
`;continue}if(H.match(/^#{1,6}\s+/))N+=`${H}
|
|
388
|
-
`}N+=`
|
|
389
|
-
`}N+=`---
|
|
390
|
-
|
|
391
|
-
`}return await Bun.write($,N),console.log(`
|
|
392
|
-
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}I.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await h6(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 B4(K))E.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:M.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{await O4(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:M.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await V4(K))E.exit(1)});I.command("doctor","Run diagnostic checks on the project").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await U4(K))E.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await j4(K))E.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await A4(K))E.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await J4(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:M.verbose}).action(async(K,Z)=>{if(!await z4(K,Z))E.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await D4(K))E.exit(1)});I.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await F4(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:M.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-hz4fjaxv.js");if(!await Z(K))E.exit(1)});I.help();I.version(p);var Q4=Bun.argv[1]||"",m6=Q4.endsWith("/bunpress")||Q4.endsWith("/cli.ts")||Q4.endsWith("/cli.js");if(m6)I.parse();
|
|
393
|
-
export{T as q,j as r,B as s,v as t,f4 as u,v6 as v,w4 as w};
|
package/dist/chunk-ynq8k1af.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{j as a,k as b,l as c,m as d,n as e,o as f,p as g}from"./chunk-7jcye3th.js";import"./chunk-3ymfys00.js";import"./chunk-rnzqf7rp.js";export{d as wrapInLayout,c as stripConfiguredBasePath,f as startServer,g as serveCLI,e as markdownToHtml,b as getConfiguredBasePath,a as decodeHtmlEntities};
|