@stacksjs/bunpress 0.1.21 → 0.2.1

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.
Files changed (57) hide show
  1. package/dist/bin/cli.d.ts +3 -0
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/commands/doctor.d.ts +1 -0
  4. package/dist/bin/commands/seo.d.ts +19 -0
  5. package/dist/{chunk-qrp18ybj.js → chunk-desvs9bx.js} +1 -1
  6. package/dist/chunk-em1tv2bw.js +38 -0
  7. package/dist/{chunk-kxr6zf7e.js → chunk-kfbpnqaw.js} +1308 -696
  8. package/dist/chunk-qqn901qf.js +393 -0
  9. package/dist/{chunk-qdmkac4z.js → chunk-qzhr4d2q.js} +10 -11
  10. package/dist/chunk-y3z183hg.js +10 -0
  11. package/dist/chunk-yfwm5337.js +2 -0
  12. package/dist/{chunk-m0g9vk1e.js → chunk-zkdm5pr7.js} +401 -194
  13. package/dist/src/build-manifest.d.ts +22 -0
  14. package/dist/src/config.d.ts +12 -0
  15. package/dist/src/data-loader.d.ts +6 -3
  16. package/dist/src/highlighter.d.ts +2 -1
  17. package/dist/src/i18n.d.ts +67 -0
  18. package/dist/src/index.d.ts +2 -0
  19. package/dist/src/index.js +1 -1
  20. package/dist/src/markdown-fences.d.ts +37 -0
  21. package/dist/src/page-meta.d.ts +19 -0
  22. package/dist/src/search-index.d.ts +61 -0
  23. package/dist/src/serve.d.ts +20 -5
  24. package/dist/src/toc.d.ts +20 -2
  25. package/dist/src/types.d.ts +80 -8
  26. package/dist/templates/blocks/alerts/caution.stx +2 -2
  27. package/dist/templates/blocks/alerts/important.stx +2 -2
  28. package/dist/templates/blocks/alerts/note.stx +2 -2
  29. package/dist/templates/blocks/alerts/tip.stx +2 -2
  30. package/dist/templates/blocks/alerts/warning.stx +2 -2
  31. package/dist/templates/blocks/containers/danger.stx +2 -2
  32. package/dist/templates/blocks/containers/details.stx +2 -2
  33. package/dist/templates/blocks/containers/info.stx +2 -2
  34. package/dist/templates/blocks/containers/raw.stx +1 -1
  35. package/dist/templates/blocks/containers/tip.stx +2 -2
  36. package/dist/templates/blocks/containers/warning.stx +2 -2
  37. package/dist/templates/copy-page.stx +81 -0
  38. package/dist/templates/doc-footer.stx +51 -0
  39. package/dist/templates/footer.stx +45 -0
  40. package/dist/templates/hero.stx +9 -2
  41. package/dist/templates/layout-doc.stx +8 -125
  42. package/dist/templates/layout-home.stx +7 -14
  43. package/dist/templates/layout-page.stx +7 -14
  44. package/dist/templates/locale-switcher.stx +115 -0
  45. package/dist/templates/navbar.stx +49 -0
  46. package/dist/templates/page-outline.stx +149 -0
  47. package/dist/templates/page-toc.stx +1 -1
  48. package/dist/templates/search-algolia.stx +85 -0
  49. package/dist/templates/search.stx +661 -0
  50. package/dist/templates/sidebar-section.stx +44 -11
  51. package/dist/templates/sidebar.stx +11 -2
  52. package/dist/themes/vitepress/index.ts +558 -165
  53. package/package.json +16 -7
  54. package/dist/chunk-9cm3e4r4.js +0 -688
  55. package/dist/chunk-mjhqecp5.js +0 -467
  56. package/dist/chunk-wmvgjzgh.js +0 -3
  57. package/dist/chunk-zmxtnx2v.js +0 -8
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
2
+ import{aa as m,da as A}from"./chunk-em1tv2bw.js";import{loadConfig as u}from"bunfig";var h={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics-configuration"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
3
3
  /* Additional BunPress customizations */
4
4
  /* Note: Base styles are provided by the VitePress theme */
5
5
 
@@ -69,6 +69,11 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
69
69
  font-size: 14px;
70
70
  line-height: 1.7;
71
71
  color: #24292f;
72
+ /* Scroll, never wrap: wrapped code loses its indentation. */
73
+ white-space: pre;
74
+ /* fit-content + min-width lets a long line extend the scroll width. */
75
+ width: fit-content;
76
+ min-width: 100%;
72
77
  }
73
78
 
74
79
  /* Dark mode code blocks */
@@ -84,95 +89,7 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
84
89
  color: #e6edf3;
85
90
  }
86
91
 
87
- /* Code groups - tabbed code blocks */
88
- .code-group {
89
- margin: 16px 0;
90
- border-radius: 8px;
91
- overflow: hidden;
92
- border: 1px solid #e2e2e3;
93
- background-color: #f6f6f7 !important;
94
- }
95
-
96
- html.dark .code-group {
97
- border-color: #3c3f44;
98
- background-color: #161618 !important;
99
- }
100
-
101
- .code-group-tabs {
102
- display: flex;
103
- background-color: #f6f6f7 !important;
104
- border-bottom: 1px solid #e2e2e3;
105
- overflow-x: auto;
106
- }
107
-
108
- html.dark .code-group-tabs {
109
- background-color: #161618 !important;
110
- border-bottom-color: #3c3f44;
111
- }
112
-
113
- .code-group-tab {
114
- padding: 12px 16px;
115
- font-size: 14px;
116
- font-weight: 500;
117
- color: #67676c;
118
- background: transparent;
119
- border: none;
120
- border-bottom: 2px solid transparent;
121
- cursor: pointer;
122
- white-space: nowrap;
123
- transition: color 0.2s, border-color 0.2s;
124
- }
125
-
126
- .code-group-tab:hover {
127
- color: #3c3c43;
128
- }
129
-
130
- .code-group-tab.active {
131
- color: #3451b2;
132
- border-bottom-color: #3451b2;
133
- }
134
-
135
- html.dark .code-group-tab {
136
- color: #9ca3af;
137
- }
138
-
139
- html.dark .code-group-tab:hover {
140
- color: #e6edf3;
141
- }
142
-
143
- html.dark .code-group-tab.active {
144
- color: #a8b1ff;
145
- border-bottom-color: #a8b1ff;
146
- }
147
-
148
- .code-group-panels {
149
- background-color: #f6f6f7 !important;
150
- }
151
-
152
- html.dark .code-group-panels {
153
- background-color: #161618 !important;
154
- }
155
-
156
- .code-group-panel {
157
- display: none;
158
- }
159
-
160
- .code-group-panel.active {
161
- display: block;
162
- }
163
-
164
- .code-group-panel pre,
165
- .code-group pre {
166
- margin: 0 !important;
167
- border-radius: 0 !important;
168
- border: none !important;
169
- background-color: #f6f6f7 !important;
170
- }
171
-
172
- html.dark .code-group-panel pre,
173
- html.dark .code-group pre {
174
- background-color: #161618 !important;
175
- }
92
+ /* Code groups are styled by the theme (codeGroupCSS), which owns the tab metrics, the active-tab bar and dark mode via CSS variables. Duplicating them here fought it: a second padding rule on top of the theme's 48px line-height inflated the tab bar to 74px, and a second border-bottom drew a second active indicator under the theme's own. */
176
93
 
177
94
  /* Language label positioning */
178
95
  pre[data-lang]::before {
@@ -228,67 +145,62 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
228
145
  margin-bottom: 12px;
229
146
  }
230
147
 
231
- /* List styling with proper indentation */
148
+ /* List styling. Scoped to a bare article element only: inside .bp-doc the theme owns lists, and duplicating them here produced two competing sets of margins. */
232
149
  article ul,
233
- article ol,
234
- .bp-doc ul,
235
- .bp-doc ol {
150
+ article ol {
236
151
  padding-left: 1.5rem;
237
152
  margin: 16px 0;
153
+ list-style-position: outside;
238
154
  }
239
155
 
240
- article ul,
241
- .bp-doc ul {
156
+ article ul {
242
157
  list-style-type: disc;
243
158
  }
244
159
 
245
- article ol,
246
- .bp-doc ol {
160
+ article ol {
247
161
  list-style-type: decimal;
248
162
  }
249
163
 
250
- article li,
251
- .bp-doc li {
252
- margin: 8px 0;
253
- line-height: 1.7;
164
+ article li {
165
+ margin: 6px 0;
166
+ line-height: 1.75;
254
167
  }
255
168
 
256
169
  /* Nested lists */
257
170
  article ul ul,
258
171
  article ol ul,
259
172
  article ul ol,
260
- article ol ol,
261
- .bp-doc ul ul,
262
- .bp-doc ol ul,
263
- .bp-doc ul ol,
264
- .bp-doc ol ol {
265
- margin: 8px 0;
173
+ article ol ol {
174
+ margin: 6px 0 0;
266
175
  padding-left: 1.5rem;
267
176
  }
268
177
 
269
- article ul ul,
270
- .bp-doc ul ul {
178
+ article ul ul {
271
179
  list-style-type: circle;
272
180
  }
273
181
 
274
- article ul ul ul,
275
- .bp-doc ul ul ul {
182
+ article ul ul ul {
276
183
  list-style-type: square;
277
184
  }
278
185
 
279
- /* Enhanced Tables */
186
+ /* Enhanced tables. The wrapper is the scroll container and owns the frame; the table stays a real table so columns size against the available width. Keep in sync with the .bp-doc table rules in the theme. */
280
187
  .table-responsive {
281
188
  overflow-x: auto;
282
- margin: 16px 0;
189
+ overscroll-behavior-x: contain;
190
+ margin: 20px 0;
283
191
  border-radius: 8px;
284
192
  border: 1px solid var(--bp-c-divider, #e2e2e3);
193
+ background-color: var(--bp-c-bg, #ffffff);
285
194
  }
286
195
 
287
196
  .enhanced-table {
197
+ display: table;
288
198
  width: 100%;
199
+ margin: 0;
200
+ border: none;
289
201
  border-collapse: collapse;
290
202
  font-size: 14px;
291
- background-color: var(--bp-c-bg, #ffffff);
203
+ line-height: 1.6;
292
204
  }
293
205
 
294
206
  .enhanced-table thead {
@@ -296,19 +208,28 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
296
208
  }
297
209
 
298
210
  .enhanced-table th {
299
- padding: 12px 16px;
211
+ padding: 10px 16px;
212
+ font-size: 13px;
300
213
  font-weight: 600;
214
+ text-align: left;
301
215
  color: var(--bp-c-text-2, #67676c);
302
- border-bottom: 2px solid var(--bp-c-divider, #e2e2e3);
216
+ border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
303
217
  white-space: nowrap;
304
218
  }
305
219
 
306
220
  .enhanced-table td {
307
- padding: 12px 16px;
221
+ padding: 10px 16px;
222
+ vertical-align: top;
308
223
  color: var(--bp-c-text-1, #3c3c43);
309
224
  border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
310
225
  }
311
226
 
227
+ /* The wrapper already draws the bottom edge. */
228
+ .enhanced-table tbody tr:last-child > td,
229
+ .enhanced-table tbody tr:last-child > th {
230
+ border-bottom: none;
231
+ }
232
+
312
233
  .enhanced-table tbody tr:nth-child(2n) {
313
234
  background-color: var(--bp-c-bg-soft, #f6f6f7);
314
235
  }
@@ -318,6 +239,29 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
318
239
  transition: background-color 0.2s ease;
319
240
  }
320
241
 
242
+ /* Long values wrap inside their column rather than dictating its width. 'anywhere' (not 'break-word') also lowers the cell's intrinsic minimum, which is what frees the auto table algorithm to widen the prose column. */
243
+ .enhanced-table td > code,
244
+ .enhanced-table th > code {
245
+ white-space: normal;
246
+ overflow-wrap: anywhere;
247
+ }
248
+
249
+ /* Narrow screens: hold a readable floor and let the wrapper scroll rather than compressing four columns into one word per line. */
250
+ @media (max-width: 767px) {
251
+ .enhanced-table {
252
+ min-width: 38rem;
253
+ }
254
+
255
+ .enhanced-table th {
256
+ white-space: normal;
257
+ }
258
+
259
+ .enhanced-table th,
260
+ .enhanced-table td {
261
+ padding: 10px 12px;
262
+ }
263
+ }
264
+
321
265
  /* Image Captions */
322
266
  .image-figure {
323
267
  margin: 24px 0;
@@ -353,47 +297,45 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
353
297
  }
354
298
 
355
299
  /* Copy Page Dropdown */
300
+ /* Rendered server-side inside .bp-page-header, so it needs no JS to be placed and no "hidden until positioned" state. */
356
301
  .copy-page-dropdown {
357
- position: absolute;
358
- right: 0;
359
- top: 50%;
360
- transform: translateY(-50%);
361
- display: none; /* Hidden until JS positions it */
362
- z-index: 10;
363
- }
364
-
365
- .copy-page-dropdown.positioned {
302
+ position: relative;
366
303
  display: inline-block;
304
+ flex-shrink: 0;
305
+ z-index: 10;
367
306
  }
368
307
 
369
- /* Page header row with H1 and Copy button */
308
+ /* Page header row: H1 on the left, copy control trailing it. */
370
309
  .bp-page-header {
371
310
  display: flex;
372
- align-items: flex-start;
311
+ align-items: baseline;
373
312
  justify-content: space-between;
374
313
  gap: 16px;
375
314
  position: relative;
376
315
  margin-bottom: 16px;
316
+ /* On narrow screens the button drops below the title instead of squeezing it into a one-word-per-line column. */
317
+ flex-wrap: wrap;
377
318
  }
378
319
 
379
320
  .bp-page-header h1 {
380
321
  margin: 0;
381
- flex: 1;
322
+ flex: 1 1 16rem;
382
323
  min-width: 0;
324
+ /* Break only where there is no other option, never mid-word while the title still has room to wrap between words. */
325
+ overflow-wrap: break-word;
326
+ word-break: normal;
327
+ hyphens: none;
383
328
  }
384
329
 
330
+ /* The control is chrome, not content: it sits on the title's baseline and stays visually quieter than the heading it accompanies. */
385
331
  .bp-page-header .copy-page-dropdown {
386
- position: relative;
387
- right: auto;
388
- top: auto;
389
- transform: none;
390
- flex-shrink: 0;
391
- margin-top: 4px;
392
- display: inline-block;
332
+ align-self: baseline;
393
333
  }
394
334
 
395
- .bp-page-header .copy-page-dropdown.positioned {
396
- display: inline-block;
335
+ @media (max-width: 639px) {
336
+ .bp-page-header {
337
+ gap: 10px;
338
+ }
397
339
  }
398
340
 
399
341
  /* Split button group */
@@ -405,31 +347,40 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
405
347
  .copy-page-button {
406
348
  display: flex;
407
349
  align-items: center;
408
- gap: 8px;
409
- padding: 8px 12px;
410
- background-color: var(--bp-c-bg-soft, #f6f6f7);
350
+ gap: 6px;
351
+ /* Deliberately smaller than body copy: this is a utility next to the page title, and at 14px/40px tall it competed with the H1. */
352
+ height: 32px;
353
+ padding: 0 10px;
354
+ background-color: transparent;
411
355
  border: 1px solid var(--bp-c-divider, #e2e2e3);
412
- color: var(--bp-c-text-1, #3c3c43);
413
- font-size: 14px;
356
+ color: var(--bp-c-text-2, #67676c);
357
+ font-family: inherit;
358
+ font-size: 13px;
414
359
  font-weight: 500;
360
+ white-space: nowrap;
415
361
  cursor: pointer;
416
- transition: all 0.2s ease;
362
+ transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
417
363
  }
418
364
 
419
365
  .copy-page-button.copy-page-main {
420
- border-radius: 8px 0 0 8px;
366
+ border-radius: 6px 0 0 6px;
421
367
  border-right: none;
422
- padding-right: 12px;
423
368
  }
424
369
 
425
370
  .copy-page-button.copy-page-toggle {
426
- border-radius: 0 8px 8px 0;
427
- padding: 8px 8px;
371
+ border-radius: 0 6px 6px 0;
372
+ padding: 0 6px;
428
373
  border-left: 1px solid var(--bp-c-divider, #e2e2e3);
429
374
  }
430
375
 
431
376
  .copy-page-button:hover {
432
- background-color: var(--bp-c-bg, #ffffff);
377
+ color: var(--bp-c-text-1, #3c3c43);
378
+ background-color: var(--bp-c-bg-soft, #f6f6f7);
379
+ }
380
+
381
+ .copy-page-button:focus-visible {
382
+ outline: 2px solid var(--bp-c-brand-1, #5672cd);
383
+ outline-offset: 2px;
433
384
  }
434
385
 
435
386
  .copy-page-button-group:hover .copy-page-button {
@@ -441,8 +392,9 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
441
392
  }
442
393
 
443
394
  .copy-page-button svg {
444
- width: 16px;
445
- height: 16px;
395
+ width: 15px;
396
+ height: 15px;
397
+ flex-shrink: 0;
446
398
  }
447
399
 
448
400
  .copy-page-button .chevron {
@@ -477,7 +429,9 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
477
429
  position: absolute;
478
430
  top: calc(100% + 8px);
479
431
  right: 0;
480
- min-width: 280px;
432
+ width: 280px;
433
+ /* The trigger sits near the left edge on a phone, so a right-anchored 280px panel hangs off-screen. Cap it to the viewport and let the start-edge clamp below flip it when there is no room to the left. */
434
+ max-width: calc(100vw - 32px);
481
435
  background-color: var(--bp-c-bg, #ffffff);
482
436
  border: 1px solid var(--bp-c-divider, #e2e2e3);
483
437
  border-radius: 12px;
@@ -485,11 +439,19 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
485
439
  opacity: 0;
486
440
  visibility: hidden;
487
441
  transform: translateY(-8px);
488
- transition: all 0.2s ease;
442
+ transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
489
443
  z-index: 100;
490
444
  overflow: hidden;
491
445
  }
492
446
 
447
+ /* Below the point where the panel is wider than the space to the trigger's left, anchor it to the start edge instead so it opens into the page. */
448
+ @media (max-width: 519px) {
449
+ .copy-page-menu {
450
+ right: auto;
451
+ left: 0;
452
+ }
453
+ }
454
+
493
455
  .copy-page-dropdown.open .copy-page-menu {
494
456
  opacity: 1;
495
457
  visibility: visible;
@@ -502,11 +464,22 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
502
464
  gap: 12px;
503
465
  padding: 12px 16px;
504
466
  color: var(--bp-c-text-1, #3c3c43);
505
- text-decoration: none;
506
467
  cursor: pointer;
507
468
  transition: background-color 0.15s ease;
508
469
  }
509
470
 
471
+ /* The control is rendered inside .bp-doc, so prose link styling (brand colour + underline) would otherwise bleed onto every menu row. */
472
+ .copy-page-dropdown a,
473
+ .copy-page-dropdown a:hover {
474
+ color: inherit;
475
+ font-weight: inherit;
476
+ text-decoration: none;
477
+ }
478
+
479
+ .copy-page-dropdown a::after {
480
+ content: none;
481
+ }
482
+
510
483
  .copy-page-menu-item:hover {
511
484
  background-color: var(--bp-c-bg-soft, #f6f6f7);
512
485
  }
@@ -831,46 +804,34 @@ function copyCode(button) {
831
804
  });
832
805
  }
833
806
 
834
- // Add copy buttons to all code blocks when page loads
835
- if (typeof document !== 'undefined') {
836
- document.addEventListener('DOMContentLoaded', () => {
837
- const codeBlocks = document.querySelectorAll('pre > code');
838
- codeBlocks.forEach(code => {
839
- const pre = code.parentElement;
840
- if (!pre || pre.querySelector('.copy-code-button')) return;
841
-
842
- const button = document.createElement('button');
843
- button.className = 'copy-code-button';
844
- button.setAttribute('onclick', 'copyCode(this)');
845
- button.setAttribute('aria-label', 'Copy code');
846
- button.innerHTML = \`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
847
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
848
- </svg>\`;
849
-
850
- pre.appendChild(button);
851
- });
852
-
853
- // Position Copy Page dropdown next to H1
854
- const h1 = document.querySelector('article.bp-doc h1');
855
- const dropdown = document.getElementById('copy-page-dropdown');
856
- if (h1 && dropdown) {
857
- // Create wrapper div for H1 and dropdown
858
- const wrapper = document.createElement('div');
859
- wrapper.className = 'bp-page-header';
860
-
861
- // Insert wrapper before H1
862
- h1.parentNode.insertBefore(wrapper, h1);
863
-
864
- // Move H1 and dropdown into wrapper
865
- wrapper.appendChild(h1);
866
- wrapper.appendChild(dropdown);
867
-
868
- // Show dropdown now that it's positioned
869
- dropdown.classList.add('positioned');
870
- }
807
+ // Add copy buttons to all code blocks.
808
+ // Idempotent and re-run after client-side navigation: the SPA router replaces
809
+ // .BPDoc wholesale, so buttons added on first load are gone from the new page.
810
+ // (The copy-page control is rendered server-side inside the content, so it
811
+ // survives the same swap without any JS.)
812
+ function addCodeCopyButtons() {
813
+ document.querySelectorAll('pre > code').forEach(code => {
814
+ const pre = code.parentElement;
815
+ if (!pre || pre.querySelector('.copy-code-button')) return;
816
+
817
+ const button = document.createElement('button');
818
+ button.className = 'copy-code-button';
819
+ button.setAttribute('onclick', 'copyCode(this)');
820
+ button.setAttribute('type', 'button');
821
+ button.setAttribute('aria-label', 'Copy code');
822
+ button.innerHTML = \`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
823
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
824
+ </svg>\`;
825
+
826
+ pre.appendChild(button);
871
827
  });
872
828
  }
873
829
 
830
+ if (typeof document !== 'undefined') {
831
+ document.addEventListener('DOMContentLoaded', addCodeCopyButtons);
832
+ document.addEventListener('bp:navigated', addCodeCopyButtons);
833
+ }
834
+
874
835
  // Copy Page Dropdown functionality
875
836
  function toggleCopyPageDropdown(event) {
876
837
  event.stopPropagation();
@@ -1185,5 +1146,251 @@ if (typeof document !== 'undefined') {
1185
1146
  }
1186
1147
  });
1187
1148
  }
1188
- `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}},q=await h({name:"bunpress",alias:"docs",defaultConfig:j});async function x(){return q}
1189
- export{j as Q,q as R,x as S};
1149
+ `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function g(Q){let V=Q.plugins;if(!Array.isArray(V)||V.length===0)return Q;let W=Q;for(let X of V){if(!X||typeof X!=="object")continue;let Z=X.name||"unnamed plugin";try{if(typeof X.extendConfig==="function")W=X.extendConfig(W)??W}catch($){console.error(`[bunpress] ${Z}: extendConfig failed \u2014`,$)}try{if(typeof X.validateConfig==="function"){let $=X.validateConfig(W);for(let j of $?.warnings??[])console.warn(`[bunpress] ${Z}: ${j}`);for(let j of $?.errors??[])console.error(`[bunpress] ${Z}: ${j}`)}}catch($){console.error(`[bunpress] ${Z}: validateConfig failed \u2014`,$)}}for(let X of V)try{X?.onConfigLoad?.(W)}catch(Z){console.error(`[bunpress] ${X?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,Z)}return W}var d=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function YQ(){return d}function E(){let Q=null;return(V)=>{let W=V.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!W)return Q!==null;let X=W[1];if(Q===null)return Q=X,!0;let Z=X[0]===Q[0],$=X.length>=Q.length;if(Z&&$&&W[2].trim()==="")Q=null;return!0}}function w(Q){let V=E();return Q.split(`
1150
+ `).filter((W)=>!V(W)).join(`
1151
+ `)}function L(Q){return`\x00BPCODE${Q}\x00`}var c=/\u0000BPCODE(\d+)\u0000/g;function l(Q){let V=[],W=E(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
1152
+ `)),X.push(L(V.length-1)),Z=null};for(let j of Q.split(`
1153
+ `)){if(W(j)){Z??=[],Z.push(j);continue}$(),X.push(j.replace(/(`+)(?:(?!\1)[\s\S])*\1/g,(J)=>{return V.push(J),L(V.length-1)}))}return $(),{masked:X.join(`
1154
+ `),restore:(j)=>j.replace(c,(J,Y)=>V[Number(Y)]??J)}}async function KQ(Q,V){let{masked:W,restore:X}=l(Q);return X(await V(W))}var s={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function y(Q){return Q.replace(/\s*<!-- toc-ignore -->\s*/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/<[^>]*>/g,"").trim()}function D(Q){return Q.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function O(Q,V){let W=Q,X=1;while(V.has(Q))Q=`${W}-${X}`,X++;return V.add(Q),Q}function P(Q,V){return O(D(Q),V)}function a(Q){let V=[],W=new Set,X=/^(#{1,6})\s+(.+)$/gm,Z;while((Z=X.exec(Q))!==null){let $=Z[1].length,j=Z[2].trim();if(!j)continue;if(j.includes("toc-ignore"))continue;let J=j.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();J=J.replace(/`([^`]+)`/g,"<code>$1</code>");let Y=J.includes("<code>"),q=P(y(j),W);V.push({level:$,text:J,id:q,children:[],hasCode:Y})}return V}function i(Q){let V=[],W=[];for(let X of Q){while(W.length>0&&W[W.length-1].level>=X.level)W.pop();if(W.length===0)V.push(X);else W[W.length-1].children.push(X);W.push(X)}return V}function o(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let Y of j){if(Z.some((G)=>{if(G.startsWith("/")&&G.endsWith("/"))return new RegExp(G.slice(1,-1)).test(Y.text);else return Y.text===G}))continue;if(Y.level>X)continue;let q=$(Y.children);if(Y.level>=W&&Y.level<=X)J.push({...Y,children:q});else J.push(...q)}return J};return $(Q)}function _(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,Y=0)=>{if(J.length===0)return"";let q=Y===0?"toc-list":"toc-sublist",G=Y===0?"toc-item":"toc-subitem";return`<ul class="${q}">
1155
+ ${J.map((z)=>{let I=z.children.length>0,K=I&&$?"toc-expand":"",M=I?j(z.children,Y+1):"",U=50,B=z.text.length>50?`${z.text.substring(0,50)}...`:z.text,N=z.text.length>50?"toc-truncate":"";return`<li class="${z.hasCode?"toc-code":""} ${K} ${G} ${N}">
1156
+ <a href="#${z.id}" class="toc-link" title="${z.text.replace(/<[^>]*>/g,"")}">${B}</a>
1157
+ ${M}
1158
+ </li>`}).join(`
1159
+ `)}
1160
+ </ul>`};return[`<nav class="${Z}" role="navigation" aria-label="${W}">`,'<div class="toc-container">',` <h2 class="toc-title">${W}</h2>`,` ${j(V)}`,"</div>","</nav>"].join(`
1161
+ `)}function C(Q){return _(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function r(Q){return _(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function n(Q){return _(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function t(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...s,...W},Z=a(Q),$=i(Z),j=o($,X);return{title:X.title,items:j,config:X}}function zQ(Q,V={}){let W=t(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=r(W);break;case"floating":$=n(W);break;default:$=_(W)}return{position:Z,data:W,html:$}})}function BQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function IQ(Q){let V=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(W,X,Z)=>{let $=P(Z.replace(/<[^>]*>/g,""),V);return`<h${X} id="${$}"><a href="#${$}" class="heading-anchor">#</a>${Z}</h${X}>`})}function NQ(){return`
1162
+ .table-of-contents {
1163
+ position: sticky;
1164
+ top: 60px; /* Match navbar height */
1165
+ height: calc(100vh - 60px);
1166
+ width: 200px;
1167
+ overflow-y: auto;
1168
+ padding: 1rem;
1169
+ }
1170
+
1171
+ .toc-container {
1172
+ padding: 0;
1173
+ }
1174
+
1175
+ .toc-title {
1176
+ margin: 0 0 1rem 0;
1177
+ font-size: 1.2rem;
1178
+ font-weight: 600;
1179
+ }
1180
+
1181
+ .toc-list,
1182
+ .toc-sublist {
1183
+ list-style: none;
1184
+ padding: 0;
1185
+ margin: 0;
1186
+ }
1187
+
1188
+ .toc-list {
1189
+ padding-left: 0;
1190
+ }
1191
+
1192
+ .toc-sublist {
1193
+ padding-left: 1rem;
1194
+ margin-top: 0.5rem;
1195
+ }
1196
+
1197
+ .toc-item,
1198
+ .toc-subitem {
1199
+ margin-bottom: 0.5rem;
1200
+ }
1201
+
1202
+ .toc-link {
1203
+ color: inherit;
1204
+ text-decoration: none;
1205
+ display: block;
1206
+ padding: 0.25rem 0;
1207
+ border-radius: 0.25rem;
1208
+ transition: background-color 0.2s;
1209
+ }
1210
+
1211
+ .toc-link:hover {
1212
+ background-color: rgba(0, 0, 0, 0.05);
1213
+ }
1214
+
1215
+ .toc-active .toc-link,
1216
+ .active-toc-item .toc-link {
1217
+ background-color: rgba(0, 123, 255, 0.1);
1218
+ font-weight: 500;
1219
+ }
1220
+
1221
+ .toc-truncate {
1222
+ /* Styles for truncated TOC items */
1223
+ }
1224
+
1225
+ .toc-truncate .toc-link {
1226
+ white-space: nowrap;
1227
+ overflow: hidden;
1228
+ text-overflow: ellipsis;
1229
+ }
1230
+
1231
+ .toc-collapse .toc-link::before {
1232
+ content: '\u25B6';
1233
+ margin-right: 0.5rem;
1234
+ transition: transform 0.2s;
1235
+ }
1236
+
1237
+ .toc-collapse.collapsed .toc-link::before {
1238
+ transform: rotate(90deg);
1239
+ }
1240
+
1241
+ .toc-expand .toc-link::before {
1242
+ content: '\u25BC';
1243
+ margin-right: 0.5rem;
1244
+ }
1245
+
1246
+ .heading-anchor {
1247
+ color: inherit;
1248
+ text-decoration: none;
1249
+ opacity: 0;
1250
+ margin-left: -1rem;
1251
+ padding-right: 0.5rem;
1252
+ transition: opacity 0.2s;
1253
+ }
1254
+
1255
+ h1:hover .heading-anchor,
1256
+ h2:hover .heading-anchor,
1257
+ h3:hover .heading-anchor,
1258
+ h4:hover .heading-anchor,
1259
+ h5:hover .heading-anchor,
1260
+ h6:hover .heading-anchor {
1261
+ opacity: 0.7;
1262
+ }
1263
+
1264
+ .heading-anchor:hover {
1265
+ opacity: 1;
1266
+ }
1267
+
1268
+ /* Smooth scrolling */
1269
+ html {
1270
+ scroll-behavior: smooth;
1271
+ }
1272
+
1273
+ /* Responsive adjustments */
1274
+ @media (max-width: 768px) {
1275
+ .toc-sidebar {
1276
+ display: none;
1277
+ }
1278
+
1279
+ .toc-floating {
1280
+ position: fixed;
1281
+ bottom: 1rem;
1282
+ right: 1rem;
1283
+ background: white;
1284
+ border: 1px solid #ddd;
1285
+ border-radius: 0.5rem;
1286
+ padding: 1rem;
1287
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
1288
+ max-width: 250px;
1289
+ }
1290
+ }
1291
+ `}function MQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1292
+ function initToc() {
1293
+ const tocLinks = document.querySelectorAll('.toc-link')
1294
+
1295
+ // Smooth scrolling for TOC links
1296
+ if (${String(V)}) tocLinks.forEach(link => {
1297
+ link.addEventListener('click', function(e) {
1298
+ e.preventDefault()
1299
+ const targetId = this.getAttribute('href')?.substring(1)
1300
+ const targetElement = document.getElementById(targetId)
1301
+
1302
+ if (targetElement) {
1303
+ targetElement.scrollIntoView({
1304
+ behavior: 'smooth',
1305
+ block: 'start'
1306
+ })
1307
+
1308
+ // Update URL without page reload
1309
+ history.pushState(null, '', \`#\${targetId}\`)
1310
+ }
1311
+ })
1312
+ })
1313
+
1314
+ // Active TOC item highlighting on scroll
1315
+ function updateActiveTocItem() {
1316
+ if (!${String(W)}) return
1317
+ const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6')
1318
+ const tocLinks = document.querySelectorAll('.toc-link')
1319
+
1320
+ let currentActive = null
1321
+ let currentDistance = Infinity
1322
+
1323
+ headings.forEach((heading, index) => {
1324
+ const rect = heading.getBoundingClientRect()
1325
+ const distance = Math.abs(rect.top)
1326
+
1327
+ if (distance < currentDistance && rect.top <= 100) {
1328
+ currentActive = heading.id
1329
+ currentDistance = distance
1330
+ }
1331
+ })
1332
+
1333
+ tocLinks.forEach(link => {
1334
+ const parent = link.parentElement
1335
+ if (parent) {
1336
+ parent.classList.remove('toc-active', 'active-toc-item')
1337
+ const href = link.getAttribute('href')?.substring(1)
1338
+ if (href === currentActive) {
1339
+ parent.classList.add('toc-active', 'active-toc-item')
1340
+ }
1341
+ }
1342
+ })
1343
+ }
1344
+
1345
+ // Throttle scroll events
1346
+ let scrollTimeout
1347
+ function throttledUpdate() {
1348
+ if (!scrollTimeout) {
1349
+ scrollTimeout = setTimeout(() => {
1350
+ updateActiveTocItem()
1351
+ scrollTimeout = null
1352
+ }, 100)
1353
+ }
1354
+ }
1355
+
1356
+ window.addEventListener('scroll', throttledUpdate)
1357
+ updateActiveTocItem()
1358
+
1359
+ // TOC collapse/expand functionality
1360
+ const expandableItems = ${String(X)} ? document.querySelectorAll('.toc-expand') : []
1361
+
1362
+ expandableItems.forEach(item => {
1363
+ item.addEventListener('click', function(e) {
1364
+ if (e.target === this || e.target.closest('.toc-link')) {
1365
+ this.classList.toggle('collapsed')
1366
+ }
1367
+ })
1368
+ })
1369
+
1370
+ // Handle URL hash on page load
1371
+ if (window.location.hash) {
1372
+ const targetId = window.location.hash.substring(1)
1373
+ const targetElement = document.getElementById(targetId)
1374
+
1375
+ if (targetElement) {
1376
+ setTimeout(() => {
1377
+ targetElement.scrollIntoView({
1378
+ behavior: 'smooth',
1379
+ block: 'start'
1380
+ })
1381
+ }, 100)
1382
+ }
1383
+ }
1384
+ }
1385
+
1386
+ // Initialize TOC when DOM is ready
1387
+ if (document.readyState === 'loading') {
1388
+ document.addEventListener('DOMContentLoaded', initToc)
1389
+ }
1390
+ else {
1391
+ initToc()
1392
+ }
1393
+ `}var{Glob:S,YAML:e}=globalThis.Bun;import{join as QQ}from"path";var DQ="/search-index.json",R={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function f(Q){let V=Q?.options??{};return{...R,...V,include:V.include??R.include,exclude:V.exclude??R.exclude,searchFields:V.searchFields??R.searchFields,maxResults:V.maxResults??Q?.maxResults??R.maxResults,boost:{...R.boost,...V.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function VQ(Q){if(!Q)return x;let V=(Array.isArray(Q)?Q:[Q]).map((Z)=>String(Z).toLowerCase()),W={meta:!1,ctrl:!1,alt:!1,shift:!1},X="";for(let Z of V)if(Z==="meta"||Z==="cmd"||Z==="command")W.meta=!0;else if(Z==="ctrl"||Z==="control")W.ctrl=!0;else if(Z==="alt"||Z==="option")W.alt=!0;else if(Z==="shift")W.shift=!0;else X=Z;if(!X)return x;return[{key:X,...W}]}function v(Q){if(typeof Q!=="function")return null;let V=Function.prototype.toString.call(Q);return V.includes("[native code]")?null:V}function OQ(Q,V){let W=Q?.search??Q?.markdown?.search,X=f(W),Z=W?.resultOptions??{};return{indexUrl:V,placeholder:W?.placeholder??"Search documentation",lazy:W?.lazy!==!1,maxResults:X.maxResults,minQueryLength:X.minQueryLength,searchFields:X.searchFields,boost:{title:X.boost.title??10,headings:X.boost.headings??5,content:X.boost.content??1},fuzzy:X.fuzzy,fuzziness:X.fuzziness,stemmer:X.stemmer,shortcuts:{keyboard:W?.keyboardShortcuts!==!1,keys:VQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:v(W?.options?.tokenize),onSearchSource:v(W?.onSearch),locale:null}}function k(Q){return w(Q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function WQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=e.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function XQ(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function ZQ(Q,V,W){let{body:X,data:Z}=WQ(V);if(Z.search===!1)return[];if(Z.layout==="home")return[];let $=typeof Z.search==="object"&&Z.search!==null?Z.search:{},j=Array.isArray($.keywords)?$.keywords.map(String):[],J=XQ(Q),Y=X.split(`
1394
+ `),q=X.match(/^#\s+(.+)$/m),G=$.title||Z.title||(q?q[1].trim():J),z=[],I=new Set,K={title:G,anchor:"",level:1,buffer:[]},M=()=>{let B=k(K.buffer.join(`
1395
+ `)).slice(0,W.maxContentLength);if(!B&&!K.title)return;let N={url:K.anchor?`${J}#${K.anchor}`:J,page:G,title:k(K.title)||G,text:B,level:K.level};if(j.length)N.keywords=j;z.push(N)},U=E();for(let B of Y){let N=U(B)?null:B.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){K.buffer.push(B);continue}let b=N[1].length,H=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=O(F?F[1]:D(y(H)),I);if(b===1){K.buffer.push("");continue}M(),K={title:H,anchor:p,level:b,buffer:[]}}return M(),z.filter((B)=>B.text||B.level>1)}function $Q(Q,V){let{storeFields:W}=V;if(!W||!W.length)return Q;let X=new Set(["url",...W]);if(V.searchFields.includes("title"))X.add("title");if(V.searchFields.includes("content"))X.add("text");if(V.searchFields.includes("headings"))X.add("page");if(V.searchFields.includes("keywords"))X.add("keywords");return Q.map((Z)=>{let $={};for(let[j,J]of Object.entries(Z))if(X.has(j)&&J!==void 0)$[j]=J;return $})}function T(Q){return Q.split("#")[0]}function jQ(Q,V){if(!V.enabled)return{locale:V.defaultLocale,page:Q};let W=Q.split("/");if(W.length>1&&V.locales.includes(W[0])&&W[0]!==V.defaultLocale)return{locale:W[0],page:W.slice(1).join("/")};let X=Q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(X&&V.locales.includes(X[2]))return{locale:X[2],page:`${X[1]}${X[3]}`};return{locale:V.defaultLocale,page:Q}}async function AQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((q)=>new S(q)),j=[],J=new Set,Y=new Map;for(let q of Z.locales)Y.set(q,new Set);for(let q of X.include){let G=new S(q);for await(let z of G.scan(Q)){let I=z.replace(/\\/g,"/");if(J.has(I))continue;if($.some((K)=>K.match(I)))continue;J.add(I);try{let K=await Bun.file(QQ(Q,I)).text(),{locale:M,page:U}=jQ(I,Z);for(let B of ZQ(U,K,X)){if(Z.enabled)B.locale=M,B.url=A(Z,M,B.url);j.push(B),Y.get(M)?.add(T(B.url))}}catch{}}}if(Z.enabled){let q=j.filter((G)=>G.locale===Z.defaultLocale);for(let G of Z.locales){if(G===Z.defaultLocale)continue;let z=Y.get(G)??new Set;for(let I of q){let K=A(Z,G,I.url);if(z.has(T(K)))continue;j.push({...I,url:K,locale:G})}}}return $Q(j,X)}
1396
+ export{h as A,g as B,d as C,YQ as D,w as E,KQ as F,s as G,y as H,D as I,O as J,P as K,a as L,i as M,o as N,_ as O,C as P,r as Q,n as R,t as S,zQ as T,BQ as U,IQ as V,NQ as W,MQ as X,DQ as Y,OQ as Z,AQ as _};