@stacksjs/bunpress 0.1.9 → 0.1.11

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/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  export * from './config';
2
2
  export * from './highlighter';
3
3
  // export * from './plugin'
4
+ // Named re-exports for RSS/sitemap/robots — `export *` would clash with the
5
+ // config interfaces (e.g. RssFeedConfig) already exported from './types'.
6
+ export { buildRssFeed, generateRssFeed } from './rss';
7
+ export { generateRobotsTxt } from './robots';
8
+ export { buildSitemap, generateSitemap } from './sitemap';
4
9
  export * from './serve';
5
10
  export * from './toc';
6
11
  export * from './types';
package/dist/rss.d.ts CHANGED
@@ -1,6 +1,16 @@
1
1
  import type { BunPressConfig } from './types';
2
2
  /**
3
- * Generate RSS feed from markdown files
3
+ * Build an RSS feed from a directory of markdown files and return the XML
4
+ * string. Use this to serve a feed dynamically from a request handler; use
5
+ * {@link generateRssFeed} to write it to disk during a static build.
6
+ *
7
+ * `config.sitemap.baseUrl` is the absolute link base, and may include a path
8
+ * prefix (e.g. `https://example.com/blog`).
9
+ */
10
+ export declare function buildRssFeed(docsDir: string, config: BunPressConfig, rssConfig?: RssFeedConfig): Promise<string>;
11
+ /**
12
+ * Generate an RSS feed and write it to disk (static-build helper). For dynamic
13
+ * serving, call {@link buildRssFeed} and return the string yourself.
4
14
  */
5
15
  export declare function generateRssFeed(docsDir: string, outputDir: string, config: BunPressConfig, rssConfig?: RssFeedConfig): Promise<void>;
6
16
  export declare interface RssFeedConfig {
package/dist/sitemap.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  import type { BunPressConfig } from './types';
2
2
  /**
3
- * Generate XML sitemap from markdown files
3
+ * Build an XML sitemap for a directory of markdown files and return the string.
4
+ * Use this to serve a sitemap dynamically from a request handler; use
5
+ * {@link generateSitemap} to write it to disk during a static build.
6
+ *
7
+ * `config.sitemap.baseUrl` is prefixed onto every `<loc>` and may include a
8
+ * path (e.g. `https://example.com/blog`).
9
+ */
10
+ export declare function buildSitemap(docsDir: string, config: BunPressConfig): Promise<string>;
11
+ /**
12
+ * Generate XML sitemap from markdown files and write it to disk (static-build
13
+ * helper). For dynamic serving, call {@link buildSitemap}.
4
14
  */
5
15
  export declare function generateSitemap(docsDir: string, outputDir: string, config: BunPressConfig): Promise<void>;
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{A as L,B as M,C as N,D as O,E as P,F as Q,G as R,H as S,I as T,J as V,K as W,L as X,M as Y,g as t,h as b,i as e,j as h,k as j,l as k,m as q,n as u,o as v,p as w,q as z,r as B,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"../chunk-dc9wxnsp.js";import"../chunk-43fsk0jg.js";export{V as wrapInLayout,T as stripConfiguredBasePath,X as startServer,Y as serveCLI,h as resetHighlighter,O as processInlineTocSyntax,w as prewarmHighlighter,j as normalizeLanguage,W as markdownToHtml,k as isLanguageSupported,u as highlightCodeSync,q as highlightCode,v as getSyntaxHighlightingStyles,z as getHighlighterInstance,S as getConfiguredBasePath,e as getConfig,E as generateUniqueSlug,Q as generateTocStyles,R as generateTocScripts,N as generateTocPositions,I as generateTocHtml,M as generateTocData,D as generateSlug,K as generateSidebarTocHtml,J as generateInlineTocHtml,L as generateFloatingTocHtml,H as filterHeadings,F as extractHeadings,P as enhanceHeadingsWithAnchors,B as defaultTocConfig,t as defaultConfig,b as config,G as buildTocHierarchy};
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-zdvnysqn.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};
@@ -3,9 +3,8 @@
3
3
  */
4
4
  export declare function loadTemplate(name: string): Promise<string>;
5
5
  /**
6
- * Render a template with data using stx engine.
7
- * Supports full stx syntax: {{ }}, {!! !!}, @if/@else/@endif,
8
- * @foreach/@endforeach, @for/@endfor, @include, <script server>, etc.
6
+ * Render a bundled Bunpress template.
7
+ * Supports escaped {{ key }} and raw {!! key !!} placeholders.
9
8
  */
10
9
  export declare function renderTemplate(template: string, data: Record<string, any>): Promise<string>;
11
10
  /**
@@ -13,7 +13,7 @@
13
13
  <style>
14
14
  .BPHomeHero {
15
15
  position: relative;
16
- padding: 64px 24px 48px;
16
+ padding: 76px 24px 56px;
17
17
  }
18
18
 
19
19
  .hero-container {
@@ -21,12 +21,12 @@
21
21
  margin: 0 auto;
22
22
  display: flex;
23
23
  flex-direction: column;
24
- align-items: center;
25
- text-align: center;
24
+ align-items: flex-start;
25
+ text-align: left;
26
26
  }
27
27
 
28
28
  .hero-content {
29
- max-width: 640px;
29
+ max-width: 780px;
30
30
  }
31
31
 
32
32
  .hero-image {
@@ -40,7 +40,7 @@
40
40
 
41
41
  @media (min-width: 960px) {
42
42
  .BPHomeHero {
43
- padding: 80px 64px 56px;
43
+ padding: 96px 64px 72px;
44
44
  }
45
45
 
46
46
  .hero-container {
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -16,7 +16,14 @@
16
16
  <!-- BPNav - Header -->
17
17
  <header class="BPNav">
18
18
  <div class="BPNavBar">
19
- {!! nav !!}
19
+ <div class="BPNavBarStart">
20
+ <a href="/" class="BPNavBarTitle">{{ title }}</a>
21
+ </div>
22
+ <div class="BPNavBarEnd">
23
+ <div class="BPNavBarMenu">
24
+ {!! nav !!}
25
+ </div>
26
+ </div>
20
27
  </div>
21
28
  </header>
22
29
 
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -20,479 +20,22 @@ export declare function getVitePressCustomBlocks(): string;
20
20
  export declare function getVitePressCodeGroups(): string;
21
21
  // Layout / chrome styles — classes referenced by layout-doc.stx, layout-page.stx, layout-home.stx,
22
22
  // and the nav/sidebar generators in serve.ts. Keeps templates declarative and dark-mode aware.
23
- export declare const layoutCSS: `/**
24
- * VitePress Theme for BunPress - Layout & Chrome
23
+ export declare const layoutCSS: .BPHome-content > .bp-doc.vp-doc.container by markdownToHtml.
25
24
  * -------------------------------------------------------------------------- */
26
25
 
27
- .Layout {
28
- min-height: 100vh;
26
+ .BPHome-content {
27
+ padding: 48px 24px 96px;
29
28
  }
30
29
 
31
- /* BPNav — top bar */
32
- .BPNav {
33
- position: fixed;
34
- top: 0;
35
- left: 0;
36
- right: 0;
37
- height: var(--bp-nav-height, 64px);
38
- background-color: var(--bp-nav-bg-color, var(--bp-c-bg));
39
- border-bottom: 1px solid var(--bp-c-divider);
40
- z-index: var(--bp-z-index-nav, 30);
41
- backdrop-filter: saturate(50%) blur(8px);
42
- }
43
-
44
- .BPNavBar {
45
- max-width: var(--bp-layout-max-width, 1440px);
46
- margin: 0 auto;
47
- width: 100%;
48
- height: 100%;
49
- display: flex;
50
- align-items: center;
51
- justify-content: space-between;
52
- padding: 0 24px;
53
- gap: 24px;
54
- }
55
-
56
- .BPNavBarStart {
57
- display: flex;
58
- align-items: center;
59
- gap: 24px;
60
- flex: 1;
61
- min-width: 0;
62
- }
63
-
64
- .BPNavBarEnd {
65
- display: flex;
66
- align-items: center;
67
- gap: 24px;
68
- flex-shrink: 0;
69
- }
70
-
71
- .BPNavBarTitle {
72
- font-size: 16px;
73
- font-weight: 600;
74
- color: var(--bp-c-text-1);
75
- white-space: nowrap;
76
- text-decoration: none;
77
- transition: color 0.25s;
78
- }
79
-
80
- .BPNavBarTitle:hover {
81
- color: var(--bp-c-brand-1);
82
- }
83
-
84
- .BPNavBarMenu {
85
- display: flex;
86
- align-items: center;
87
- gap: 24px;
88
- }
89
-
90
- .BPNavBarMenu a,
91
- .BPNavBarMenu .BPNavBarMenu-link {
92
- font-size: 14px;
93
- font-weight: 500;
94
- color: var(--bp-c-text-1);
95
- text-decoration: none;
96
- transition: color 0.25s;
97
- cursor: pointer;
98
- }
99
-
100
- .BPNavBarMenu a:hover,
101
- .BPNavBarMenu .BPNavBarMenu-link:hover,
102
- .BPNavBarMenu a.is-active {
103
- color: var(--bp-c-brand-1);
104
- }
105
-
106
- .BPNavBarMenu-group {
107
- position: relative;
108
- }
109
-
110
- .BPNavBarMenu-group-button {
111
- display: inline-flex;
112
- align-items: center;
113
- gap: 4px;
114
- background: transparent;
115
- border: none;
116
- padding: 0;
117
- font: inherit;
118
- font-size: 14px;
119
- font-weight: 500;
120
- color: var(--bp-c-text-1);
121
- cursor: pointer;
122
- transition: color 0.25s;
123
- }
124
-
125
- .BPNavBarMenu-group-button:hover {
126
- color: var(--bp-c-brand-1);
127
- }
128
-
129
- .BPNavBarMenu-group-button .chevron {
130
- width: 12px;
131
- height: 12px;
132
- flex-shrink: 0;
133
- transition: transform 0.25s;
134
- }
135
-
136
- .BPNavBarMenu-group:hover > .BPNavBarMenu-group-button .chevron {
137
- transform: rotate(180deg);
138
- }
139
-
140
- .BPNavBarMenu-group-items {
141
- display: none;
142
- position: absolute;
143
- right: 0;
144
- top: 100%;
145
- margin-top: 8px;
146
- padding: 8px 0;
147
- min-width: 192px;
148
- background: var(--bp-c-bg);
149
- border: 1px solid var(--bp-c-divider);
150
- border-radius: 8px;
151
- box-shadow: var(--bp-shadow-3, 0 12px 32px rgba(0, 0, 0, 0.1));
152
- z-index: 10;
153
- }
154
-
155
- .BPNavBarMenu-group:hover > .BPNavBarMenu-group-items {
156
- display: block;
157
- }
158
-
159
- .BPNavBarMenu-group-items a {
160
- display: block;
161
- padding: 6px 16px;
162
- font-size: 13px;
163
- color: var(--bp-c-text-1);
164
- text-decoration: none;
165
- transition: color 0.25s, background-color 0.25s;
166
- }
167
-
168
- .BPNavBarMenu-group-items a:hover {
169
- color: var(--bp-c-brand-1);
170
- background-color: var(--bp-c-bg-soft);
171
- }
172
-
173
- /* Search */
174
- .BPNavBarSearch {
175
- position: relative;
176
- display: flex;
177
- align-items: center;
178
- max-width: 260px;
179
- width: 100%;
180
- }
181
-
182
- .BPNavBarSearch-icon {
183
- position: absolute;
184
- left: 12px;
185
- width: 16px;
186
- height: 16px;
187
- color: var(--bp-c-text-3);
188
- pointer-events: none;
189
- }
190
-
191
- .BPNavBarSearch-input {
192
- width: 100%;
193
- height: 32px;
194
- padding: 0 48px 0 36px;
195
- font: inherit;
196
- font-size: 13px;
197
- background-color: var(--bp-c-bg-alt);
198
- border: 1px solid var(--bp-c-divider);
199
- border-radius: 4px;
200
- color: var(--bp-c-text-1);
201
- outline: none;
202
- transition: border-color 0.25s, background-color 0.25s;
203
- }
204
-
205
- .BPNavBarSearch-input::placeholder {
206
- color: var(--bp-c-text-3);
207
- }
208
-
209
- .BPNavBarSearch-input:hover,
210
- .BPNavBarSearch-input:focus {
211
- border-color: var(--bp-c-brand-1);
212
- background-color: var(--bp-c-bg);
213
- }
214
-
215
- .BPNavBarSearch-kbd {
216
- position: absolute;
217
- right: 8px;
218
- padding: 2px 6px;
219
- font-size: 11px;
220
- font-weight: 600;
221
- font-family: inherit;
222
- color: var(--bp-c-text-3);
223
- background-color: var(--bp-c-bg);
224
- border: 1px solid var(--bp-c-divider);
225
- border-radius: 4px;
226
- pointer-events: none;
227
- }
228
-
229
- /* Social/icon links cluster */
230
- .BPSocialLinks {
231
- display: flex;
232
- align-items: center;
233
- gap: 12px;
234
- padding-left: 24px;
235
- border-left: 1px solid var(--bp-c-divider);
236
- }
237
-
238
- .BPSocialLinks > a {
239
- display: inline-flex;
240
- align-items: center;
241
- justify-content: center;
242
- width: 32px;
243
- height: 32px;
244
- color: var(--bp-c-text-2);
245
- border-radius: 4px;
246
- transition: color 0.25s, background-color 0.25s;
247
- }
248
-
249
- .BPSocialLinks > a:hover {
250
- color: var(--bp-c-text-1);
251
- background-color: var(--bp-c-bg-soft);
252
- }
253
-
254
- .BPSocialLinks > a svg {
255
- width: 20px;
256
- height: 20px;
257
- }
258
-
259
- /* Content area */
260
- .BPContent {
261
- flex: 1;
262
- }
263
-
264
- .BPContent--doc {
265
- position: fixed;
266
- top: var(--bp-nav-height, 64px);
267
- bottom: 0;
268
- overflow-y: auto;
269
- left: max(var(--bp-sidebar-width, 272px), calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + var(--bp-sidebar-width, 272px)));
270
- right: max(0px, calc((100vw - var(--bp-layout-max-width, 1440px)) / 2));
271
- }
272
-
273
- .BPContent--page {
274
- padding-top: var(--bp-nav-height, 64px);
275
- }
276
-
277
- .BPDoc {
278
- padding: 32px 24px;
279
- padding-right: 32px;
280
- }
281
-
282
- @media (min-width: 1280px) {
283
- .BPDoc {
284
- padding: 48px 32px 128px;
285
- }
286
- }
287
-
288
- .BPDocContent {
289
- max-width: 768px;
290
- margin: 0;
291
- }
292
-
293
- .BPPage {
294
- padding: 48px 24px;
295
- max-width: 768px;
30
+ .BPHome-content .container {
296
31
  margin: 0 auto;
297
- }
298
-
299
- @media (min-width: 1280px) {
300
- .BPPage {
301
- padding: 64px 32px;
302
- }
303
- }
304
-
305
- /* Mobile sidebar drawer behaviour */
306
- @media (max-width: 959px) {
307
- .BPNavBarSearch {
308
- display: none;
309
- }
310
- .BPSocialLinks {
311
- padding-left: 12px;
312
- gap: 8px;
313
- }
314
- .BPNavBarMenu {
315
- display: none;
316
- }
317
- }
318
-
319
- /**
320
- * Hero (home layout) — used by hero.stx + serve.ts generateHero
321
- * -------------------------------------------------------------------------- */
322
-
323
- .BPHero-name {
324
- font-size: 20px;
325
- font-weight: 700;
326
- letter-spacing: -0.02em;
327
- line-height: 1.2;
328
- margin: 0 0 8px;
329
- background: linear-gradient(135deg, var(--bp-c-brand-1, #5672cd) 0%, var(--bp-c-brand-2, #8b9cf7) 100%);
330
- -webkit-background-clip: text;
331
- -webkit-text-fill-color: transparent;
332
- background-clip: text;
333
- }
334
-
335
- .BPHero-text {
336
- font-size: 40px;
337
- font-weight: 800;
338
- letter-spacing: -0.02em;
339
- line-height: 1.1;
340
- color: var(--bp-c-text-1);
341
- margin: 0 0 8px;
342
- }
343
-
344
- .BPHero-tagline {
345
- font-size: 18px;
346
- font-weight: 400;
347
- line-height: 1.6;
348
- color: var(--bp-c-text-2);
349
- margin: 12px 0 0;
350
- }
351
-
352
- @media (min-width: 960px) {
353
- .BPHero-name {
354
- font-size: 24px;
355
- }
356
- .BPHero-text {
357
- font-size: 56px;
358
- }
359
- .BPHero-tagline {
360
- font-size: 20px;
361
- }
362
- }
363
-
364
- .BPHero-actions {
365
- display: flex;
366
- flex-wrap: wrap;
367
- gap: 12px;
368
- margin-top: 28px;
369
- }
370
-
371
- .BPButton {
372
- display: inline-flex;
373
- align-items: center;
374
- justify-content: center;
375
- padding: 0 24px;
376
- height: 40px;
377
- font-size: 14px;
378
- font-weight: 600;
379
- border-radius: 20px;
380
- text-decoration: none;
381
- transition: background-color 0.25s, color 0.25s, border-color 0.25s;
382
- border: 1px solid transparent;
383
- white-space: nowrap;
384
- cursor: pointer;
385
- }
386
-
387
- .BPButton-brand {
388
- color: var(--bp-button-brand-text, #fff);
389
- background-color: var(--bp-c-brand-1);
390
- border-color: var(--bp-c-brand-1);
391
- }
392
-
393
- .BPButton-brand:hover {
394
- background-color: var(--bp-c-brand-2);
395
- border-color: var(--bp-c-brand-2);
396
- }
397
-
398
- .BPButton-alt {
399
- color: var(--bp-c-text-1);
400
- background-color: transparent;
401
- border-color: var(--bp-c-divider);
402
- }
403
-
404
- .BPButton-alt:hover {
405
- border-color: var(--bp-c-text-2);
406
- color: var(--bp-c-brand-1);
407
- }
408
-
409
- /**
410
- * Features grid — used by features.stx + serve.ts generateFeatures
411
- * -------------------------------------------------------------------------- */
412
-
413
- .BPHomeFeatures {
414
- padding: 48px 24px;
415
- border-top: 1px solid var(--bp-c-divider);
416
- }
417
-
418
- .BPHomeFeatures-inner {
419
32
  max-width: 1152px;
420
- margin: 0 auto;
421
- }
422
-
423
- .BPFeatures {
424
- display: grid;
425
- grid-template-columns: repeat(1, 1fr);
426
- gap: 16px;
427
- }
428
-
429
- @media (min-width: 640px) {
430
- .BPFeatures {
431
- grid-template-columns: repeat(2, 1fr);
432
- gap: 24px;
433
- }
434
33
  }
435
34
 
436
35
  @media (min-width: 960px) {
437
- .BPHomeFeatures {
438
- padding: 64px 32px;
36
+ .BPHome-content {
37
+ padding: 64px 32px 128px;
439
38
  }
440
- .BPFeatures {
441
- grid-template-columns: repeat(3, 1fr);
442
- }
443
- }
444
-
445
- .BPFeature {
446
- display: block;
447
- padding: 24px;
448
- background-color: var(--bp-c-bg-soft, var(--bp-c-bg-alt));
449
- border: 1px solid var(--bp-c-divider);
450
- border-radius: 12px;
451
- transition: border-color 0.25s, box-shadow 0.25s;
452
- text-decoration: none;
453
- color: inherit;
454
- }
455
-
456
- .BPFeature:hover {
457
- border-color: var(--bp-c-brand-1);
458
- box-shadow: 0 2px 12px rgba(86, 114, 205, 0.08);
459
- }
460
-
461
- .BPFeature-icon {
462
- width: 40px;
463
- height: 40px;
464
- display: flex;
465
- align-items: center;
466
- justify-content: center;
467
- border-radius: 8px;
468
- background: var(--bp-c-brand-soft, rgba(86, 114, 205, 0.1));
469
- color: var(--bp-c-brand-1);
470
- margin-bottom: 12px;
471
- }
472
-
473
- .BPFeature-icon svg {
474
- width: 24px;
475
- height: 24px;
476
- }
477
-
478
- .BPFeature-icon-text {
479
- font-size: 24px;
480
- font-weight: 700;
481
- }
482
-
483
- .BPFeature-title {
484
- margin: 0 0 8px;
485
- font-size: 16px;
486
- font-weight: 600;
487
- line-height: 1.4;
488
- color: var(--bp-c-text-1);
489
- }
490
-
491
- .BPFeature-details {
492
- margin: 0;
493
- font-size: 14px;
494
- line-height: 1.6;
495
- color: var(--bp-c-text-2);
496
39
  }
497
40
 
498
41
  /**