@stacksjs/bunpress 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -15,17 +15,20 @@ BunPress is a lightning-fast static site generator designed specifically for doc
15
15
  ## Features
16
16
 
17
17
  ### Core Features
18
+
18
19
  - ⚡ **Lightning Fast** - 0.18s build time (4,000 files), 11x faster than Eleventy
19
20
  - 📝 **Rich Markdown** - VitePress-compatible markdown with containers, alerts, code groups, and syntax highlighting
20
21
  - 📋 **Smart TOC** - Automatic table of contents with filtering, positioning (sidebar/inline/floating), and interactive navigation
21
22
  - 🛠️ **Developer Friendly** - Native TypeScript support, comprehensive CLI (15+ commands), and extensive customization
22
23
 
23
24
  ### SEO & Analytics
25
+
24
26
  - 🔍 **Complete SEO** - Auto-generated sitemap.xml, robots.txt, Open Graph tags, and JSON-LD structured data
25
27
  - 📊 **Fathom Analytics** - Privacy-focused analytics with GDPR/CCPA compliance and DNT support
26
28
  - 🔎 **SEO Validation** - Built-in SEO checker with auto-fix mode for common issues
27
29
 
28
30
  ### Markdown Extensions (VitePress-Compatible)
31
+
29
32
  - ✅ Custom containers (info, tip, warning, danger, details, raw)
30
33
  - ✅ GitHub-flavored alerts (note, tip, important, warning, caution)
31
34
  - ✅ Code features (line highlighting, line numbers, focus, diffs, errors/warnings, groups)
@@ -33,8 +36,10 @@ BunPress is a lightning-fast static site generator designed specifically for doc
33
36
  - ✅ Tables with alignment and formatting
34
37
  - ✅ Image enhancements with captions and lazy loading
35
38
  - ✅ Custom header anchors and inline TOC
39
+ - ✅ **STX template syntax** in markdown — dynamic content with `@if`, `@foreach`, `{{ }}`, `<script server>`
36
40
 
37
41
  ### Developer Experience
42
+
38
43
  - 🚀 **Fast Dev Server** - ~100ms startup, hot reload, and instant feedback
39
44
  - 📦 **Small Bundles** - ~45KB per page (HTML + JS + CSS)
40
45
  - 💚 **Low Memory** - ~50MB dev server, ~250MB peak for 1000 files
@@ -113,6 +118,84 @@ export default {
113
118
  }
114
119
  ```
115
120
 
121
+ ## STX Templates in Markdown
122
+
123
+ BunPress supports [STX](https://stx.sh) template syntax directly inside markdown files. This enables dynamic content generation — conditionals, loops, computed values, and more — powered by the STX templating engine.
124
+
125
+ ### Server Scripts
126
+
127
+ Define variables and logic in `<script server>` blocks:
128
+
129
+ ```markdown
130
+ <script server>
131
+ const features = [
132
+ { name: 'Fast', desc: 'Built with Zig for maximum performance' },
133
+ { name: 'Modern', desc: 'ES modules and TypeScript native' },
134
+ { name: 'Simple', desc: 'Zero config, one binary' },
135
+ ]
136
+ const showBeta = false
137
+ </script>
138
+
139
+ # Features
140
+
141
+ @foreach (features as feature)
142
+ ### {{ feature.name }}
143
+
144
+ {{ feature.desc }}
145
+
146
+ @endforeach
147
+
148
+ @if (showBeta)
149
+ ## Beta Features
150
+
151
+ These features are coming soon.
152
+ @endif
153
+ ```
154
+
155
+ ### Available Directives
156
+
157
+ | Directive | Description |
158
+ |-----------|------------|
159
+ | `<script server>` | Define variables and run server-side logic |
160
+ | `{{ expression }}` | Output an escaped expression |
161
+ | `{!! expression !!}` | Output raw (unescaped) HTML |
162
+ | `@if (condition)` / `@else` / `@endif` | Conditional rendering |
163
+ | `@foreach (array as item)` / `@endforeach` | Iterate over arrays |
164
+ | `@foreach (array as item, index)` | Iterate with index |
165
+ | `@for (let i = 0; i < n; i++)` / `@endfor` | C-style for loops |
166
+ | `@include('Component')` | Include STX components |
167
+
168
+ ### Frontmatter Access
169
+
170
+ Frontmatter values are automatically available in STX expressions:
171
+
172
+ ```markdown
173
+ ---
174
+ title: My Page
175
+ author: Chris
176
+ ---
177
+
178
+ # {{ title }}
179
+
180
+ Written by {{ author }}.
181
+ ```
182
+
183
+ ### Inline Expressions
184
+
185
+ Use expressions anywhere in your markdown:
186
+
187
+ ```markdown
188
+ <script server>
189
+ const count = 42
190
+ const items = ['Alpha', 'Beta', 'Gamma']
191
+ </script>
192
+
193
+ There are {{ count }} items and {{ items.length }} categories.
194
+ The sum is {{ 10 + 20 + 12 }}.
195
+ ```
196
+
197
+ STX processing happens before markdown conversion, so the output of STX directives is treated as regular markdown and rendered accordingly — headings, lists, bold, code blocks, and all other markdown features work as expected.
198
+
116
199
  ## CLI Commands
117
200
 
118
201
  BunPress provides a comprehensive CLI for managing your documentation:
@@ -143,14 +226,75 @@ bunpress config:validate # Validate configuration
143
226
 
144
227
  ## Performance Benchmarks
145
228
 
146
- BunPress is **the fastest** documentation generator available. Our benchmarks use the same methodology as [11ty's official performance tests](https://www.11ty.dev/docs/performance/) with 4,000 markdown files:
229
+ BunPress is **the fastest** documentation generator available, powered by Bun's built-in Zig-based markdown parser.
230
+
231
+ ### Markdown Engine Benchmarks
232
+
233
+ Real benchmark results comparing BunPress against documentation frameworks and popular markdown engines. All engines configured with equivalent GFM features (tables, strikethrough, task lists, autolinks). Tested on Apple M3 Pro, 18GB RAM, Bun 1.3.10.
234
+
235
+ > **Fairness note:** These results are conservative. Real VitePress adds Shiki syntax highlighting + Vue plugins on top of markdown-it. Real Astro adds Shiki on top of remark/rehype. commonmark.js does not support GFM, so it processes fewer features and appears artificially fast.
236
+
237
+ #### Simple Markdown (paragraph + inline formatting)
238
+
239
+ | Engine | Avg Time | vs BunPress |
240
+ |--------|---------|-------------|
241
+ | **BunPress** | **2.09 µs** | - |
242
+ | commonmark (no GFM) | 3.91 µs | 1.9x slower |
243
+ | Eleventy | 4.93 µs | 2.4x slower |
244
+ | VitePress | 7.87 µs | 3.8x slower |
245
+ | marked | 29.67 µs | 14x slower |
246
+ | showdown | 32.48 µs | 16x slower |
247
+ | micromark | 120.10 µs | 57x slower |
248
+ | Astro | 126.36 µs | 60x slower |
249
+
250
+ #### Real-World Doc Page (~3KB markdown)
251
+
252
+ | Engine | Avg Time | vs BunPress |
253
+ |--------|---------|-------------|
254
+ | **BunPress** | **28.60 µs** | - |
255
+ | commonmark (no GFM) | 101.47 µs | 3.5x slower |
256
+ | Eleventy | 124.67 µs | 4.4x slower |
257
+ | VitePress | 178.68 µs | 6.2x slower |
258
+ | showdown | 791.29 µs | 28x slower |
259
+ | marked | 841.17 µs | 29x slower |
260
+ | micromark | 2.03 ms | 71x slower |
261
+ | Astro | 2.56 ms | 90x slower |
262
+
263
+ #### Large Document Stress Test (~33KB markdown)
264
+
265
+ | Engine | Avg Time | vs BunPress |
266
+ |--------|---------|-------------|
267
+ | **BunPress** | **204.97 µs** | - |
268
+ | commonmark (no GFM) | 1.01 ms | 4.9x slower |
269
+ | Eleventy | 1.07 ms | 5.2x slower |
270
+ | VitePress | 1.40 ms | 6.8x slower |
271
+ | showdown | 12.76 ms | 62x slower |
272
+ | micromark | 21.61 ms | 105x slower |
273
+ | Astro | 26.56 ms | 130x slower |
274
+ | marked | 47.41 ms | 231x slower |
275
+
276
+ #### Throughput: 100 Mixed Documents
277
+
278
+ | Engine | Avg Time | vs BunPress |
279
+ |--------|---------|-------------|
280
+ | **BunPress** | **827.40 µs** | - |
281
+ | commonmark (no GFM) | 3.45 ms | 4.2x slower |
282
+ | Eleventy | 3.80 ms | 4.6x slower |
283
+ | VitePress | 4.85 ms | 5.9x slower |
284
+ | marked | 17.43 ms | 21x slower |
285
+ | showdown | 25.29 ms | 31x slower |
286
+ | micromark | 72.79 ms | 88x slower |
287
+ | Astro | 84.95 ms | 103x slower |
147
288
 
148
289
  ### Build Performance (4,000 markdown files)
149
290
 
291
+ Using the same methodology as [11ty's official performance tests](https://www.11ty.dev/docs/performance/):
292
+
150
293
  | Generator | Build Time | vs BunPress |
151
294
  |-----------|-----------|-------------|
152
295
  | **BunPress** | **0.18s** | - |
153
296
  | Eleventy | 1.93s | 11x slower |
297
+ | VitePress | 8.50s | 47x slower |
154
298
  | Astro | 22.90s | 130x slower |
155
299
  | Gatsby | 29.05s | 165x slower |
156
300
  | Next.js | 70.65s | 401x slower |
@@ -160,15 +304,15 @@ BunPress is **the fastest** documentation generator available. Our benchmarks us
160
304
  | Generator | Build Time | vs BunPress |
161
305
  |-----------|-----------|-------------|
162
306
  | **BunPress** | **4.12s** | - |
307
+ | VitePress | 8.50s | 2x slower |
163
308
  | Astro | 22.90s | 5.6x slower |
164
309
  | Gatsby | 29.05s | 7x slower |
165
310
  | Next.js | 70.65s | 17x slower |
166
311
 
167
- **BunPress processes 22,000+ files per second** in fast mode, making it the fastest static site generator for documentation.
312
+ Run the benchmarks yourself:
168
313
 
169
- Run the benchmark yourself:
170
314
  ```bash
171
- bun test test/benchmark.test.ts
315
+ cd benchmark && bun install && bun run bench
172
316
  ```
173
317
 
174
318
  ## Testing
package/dist/bin/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{e as a,f as b}from"../chunk-16hpnayn.js";import"../chunk-nt1zw6bf.js";export{a as findMarkdownFiles,b as buildDocs};
3
+ import{e as a,f as b}from"../chunk-z0redasq.js";import"../chunk-1ymh7yt2.js";export{a as findMarkdownFiles,b as buildDocs};