@ox-content/vite-plugin 1.0.0-alpha.0 → 2.0.0

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 (58) hide show
  1. package/dist/chunk.cjs +39 -49
  2. package/dist/github.cjs +323 -3
  3. package/dist/github.cjs.map +1 -0
  4. package/dist/github.mjs +2 -0
  5. package/dist/{github2.js → github2.mjs} +2 -3
  6. package/dist/github2.mjs.map +1 -0
  7. package/dist/index.cjs +1371 -598
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +114 -69
  10. package/dist/index.d.cts.map +1 -1
  11. package/dist/index.d.mts +1960 -0
  12. package/dist/index.d.mts.map +1 -0
  13. package/dist/{index.js → index.mjs} +1383 -623
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/mermaid.cjs +115 -3
  16. package/dist/mermaid.cjs.map +1 -0
  17. package/dist/{mermaid2.js → mermaid.mjs} +14 -6
  18. package/dist/mermaid.mjs.map +1 -0
  19. package/dist/mermaid2.mjs +2 -0
  20. package/dist/ogp.cjs +316 -3
  21. package/dist/ogp.cjs.map +1 -0
  22. package/dist/ogp.mjs +2 -0
  23. package/dist/{ogp2.js → ogp2.mjs} +2 -3
  24. package/dist/ogp2.mjs.map +1 -0
  25. package/dist/tabs.cjs +212 -3
  26. package/dist/tabs.cjs.map +1 -0
  27. package/dist/tabs.mjs +2 -0
  28. package/dist/{tabs2.js → tabs2.mjs} +2 -3
  29. package/dist/tabs2.mjs.map +1 -0
  30. package/dist/youtube.cjs +135 -3
  31. package/dist/youtube.cjs.map +1 -0
  32. package/dist/youtube.mjs +2 -0
  33. package/dist/{youtube2.js → youtube2.mjs} +2 -3
  34. package/dist/youtube2.mjs.map +1 -0
  35. package/package.json +61 -56
  36. package/dist/github.js +0 -3
  37. package/dist/github2.cjs +0 -313
  38. package/dist/github2.cjs.map +0 -1
  39. package/dist/github2.js.map +0 -1
  40. package/dist/index.d.ts +0 -1915
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/index.js.map +0 -1
  43. package/dist/mermaid.js +0 -3
  44. package/dist/mermaid2.cjs +0 -92
  45. package/dist/mermaid2.cjs.map +0 -1
  46. package/dist/mermaid2.js.map +0 -1
  47. package/dist/ogp.js +0 -3
  48. package/dist/ogp2.cjs +0 -306
  49. package/dist/ogp2.cjs.map +0 -1
  50. package/dist/ogp2.js.map +0 -1
  51. package/dist/tabs.js +0 -3
  52. package/dist/tabs2.cjs +0 -203
  53. package/dist/tabs2.cjs.map +0 -1
  54. package/dist/tabs2.js.map +0 -1
  55. package/dist/youtube.js +0 -3
  56. package/dist/youtube2.cjs +0 -127
  57. package/dist/youtube2.cjs.map +0 -1
  58. package/dist/youtube2.js.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,1915 +0,0 @@
1
- import { LanguageRegistration, LanguageRegistration as LanguageRegistration$1 } from "shiki";
2
- import { EnvironmentOptions, Plugin } from "vite";
3
-
4
- //#region src/theme.d.ts
5
-
6
- /**
7
- * Theme API for ox-content SSG
8
- *
9
- * Provides VitePress-like theming with default theme + customization.
10
- */
11
- /**
12
- * Theme color configuration.
13
- */
14
- interface ThemeColors {
15
- /** Primary accent color */
16
- primary?: string;
17
- /** Primary color on hover */
18
- primaryHover?: string;
19
- /** Background color */
20
- background?: string;
21
- /** Alternative background color (sidebar, code blocks) */
22
- backgroundAlt?: string;
23
- /** Main text color */
24
- text?: string;
25
- /** Muted/secondary text color */
26
- textMuted?: string;
27
- /** Border color */
28
- border?: string;
29
- /** Code block background color */
30
- codeBackground?: string;
31
- /** Code block text color */
32
- codeText?: string;
33
- }
34
- /**
35
- * Theme layout configuration.
36
- */
37
- interface ThemeLayout {
38
- /** Sidebar width (CSS value, e.g., "260px") */
39
- sidebarWidth?: string;
40
- /** Header height (CSS value, e.g., "60px") */
41
- headerHeight?: string;
42
- /** Maximum content width (CSS value, e.g., "960px") */
43
- maxContentWidth?: string;
44
- }
45
- /**
46
- * Theme font configuration.
47
- */
48
- interface ThemeFonts {
49
- /** Sans-serif font stack */
50
- sans?: string;
51
- /** Monospace font stack */
52
- mono?: string;
53
- }
54
- /**
55
- * Theme header configuration.
56
- */
57
- interface ThemeHeader {
58
- /** Logo image URL */
59
- logo?: string;
60
- /** Logo width in pixels */
61
- logoWidth?: number;
62
- /** Logo height in pixels */
63
- logoHeight?: number;
64
- }
65
- /**
66
- * Theme footer configuration.
67
- */
68
- interface ThemeFooter {
69
- /** Footer message (supports HTML) */
70
- message?: string;
71
- /** Copyright text (supports HTML) */
72
- copyright?: string;
73
- }
74
- /**
75
- * Social links configuration.
76
- */
77
- interface SocialLinks {
78
- /** GitHub URL */
79
- github?: string;
80
- /** Twitter/X URL */
81
- twitter?: string;
82
- /** Discord URL */
83
- discord?: string;
84
- }
85
- /**
86
- * Embedded HTML content for specific positions in the page layout.
87
- */
88
- interface ThemeEmbed {
89
- /** Content to embed into <head> */
90
- head?: string;
91
- /** Content before header */
92
- headerBefore?: string;
93
- /** Content after header */
94
- headerAfter?: string;
95
- /** Content before sidebar navigation */
96
- sidebarBefore?: string;
97
- /** Content after sidebar navigation */
98
- sidebarAfter?: string;
99
- /** Content before main content */
100
- contentBefore?: string;
101
- /** Content after main content */
102
- contentAfter?: string;
103
- /** Content before footer */
104
- footerBefore?: string;
105
- /** Custom footer content (replaces default footer) */
106
- footer?: string;
107
- }
108
- /**
109
- * Complete theme configuration.
110
- */
111
- interface ThemeConfig {
112
- /** Theme name for identification */
113
- name?: string;
114
- /** Base theme to extend */
115
- extends?: ThemeConfig;
116
- /** Light mode colors (maps to CSS variables) */
117
- colors?: ThemeColors;
118
- /** Dark mode colors (maps to CSS variables) */
119
- darkColors?: ThemeColors;
120
- /** Font configuration (maps to CSS variables) */
121
- fonts?: ThemeFonts;
122
- /** Layout configuration (maps to CSS variables) */
123
- layout?: ThemeLayout;
124
- /** Header configuration */
125
- header?: ThemeHeader;
126
- /** Footer configuration */
127
- footer?: ThemeFooter;
128
- /** Social links configuration */
129
- socialLinks?: SocialLinks;
130
- /** Embedded HTML content at specific positions */
131
- embed?: ThemeEmbed;
132
- /** Additional custom CSS */
133
- css?: string;
134
- /** Additional custom JavaScript */
135
- js?: string;
136
- }
137
- /**
138
- * Resolved theme configuration (after merging with defaults).
139
- */
140
- interface ResolvedThemeConfig {
141
- name: string;
142
- colors: ThemeColors;
143
- darkColors: ThemeColors;
144
- fonts: ThemeFonts;
145
- layout: ThemeLayout;
146
- header: ThemeHeader;
147
- footer: ThemeFooter;
148
- socialLinks: SocialLinks;
149
- embed: ThemeEmbed;
150
- css: string;
151
- js: string;
152
- }
153
- /**
154
- * Default theme configuration.
155
- * Based on the current ox-content SSG styles.
156
- */
157
- declare const defaultTheme: ThemeConfig;
158
- /**
159
- * Defines a theme configuration with type checking.
160
- *
161
- * @example
162
- * ```ts
163
- * const myTheme = defineTheme({
164
- * extends: defaultTheme,
165
- * colors: {
166
- * primary: '#3498db',
167
- * },
168
- * footer: {
169
- * copyright: '2025 My Company',
170
- * },
171
- * });
172
- * ```
173
- */
174
- declare function defineTheme(config: ThemeConfig): ThemeConfig;
175
- /**
176
- * Merges multiple theme configurations.
177
- * Later themes override earlier ones.
178
- *
179
- * @example
180
- * ```ts
181
- * const merged = mergeThemes(defaultTheme, customTheme, overrides);
182
- * ```
183
- */
184
- declare function mergeThemes(...themes: ThemeConfig[]): ThemeConfig;
185
- /**
186
- * Resolves a theme configuration by merging with its extends chain and defaults.
187
- */
188
- declare function resolveTheme(config?: ThemeConfig): ResolvedThemeConfig;
189
- /**
190
- * Converts resolved theme to the format expected by Rust NAPI.
191
- */
192
- //#endregion
193
- //#region src/types.d.ts
194
- /**
195
- * Hero section action button.
196
- */
197
- interface HeroAction {
198
- /** Button theme: 'brand' (primary) or 'alt' (secondary) */
199
- theme?: "brand" | "alt";
200
- /** Button text */
201
- text: string;
202
- /** Link URL */
203
- link: string;
204
- }
205
- /**
206
- * Hero section image configuration.
207
- */
208
- interface HeroImage {
209
- /** Image source URL */
210
- src: string;
211
- /** Alt text */
212
- alt?: string;
213
- /** Image width */
214
- width?: number;
215
- /** Image height */
216
- height?: number;
217
- }
218
- /**
219
- * Hero section configuration for entry page.
220
- */
221
- interface HeroConfig {
222
- /** Main title (large, gradient text) */
223
- name?: string;
224
- /** Secondary text (medium size) */
225
- text?: string;
226
- /** Tagline (smaller, muted) */
227
- tagline?: string;
228
- /** Hero image */
229
- image?: HeroImage;
230
- /** Action buttons */
231
- actions?: HeroAction[];
232
- }
233
- /**
234
- * Feature card for entry page.
235
- */
236
- interface FeatureConfig {
237
- /** Icon - supports: "mdi:icon-name" (Iconify), image URL, or emoji */
238
- icon?: string;
239
- /** Feature title */
240
- title: string;
241
- /** Feature description */
242
- details?: string;
243
- /** Optional link */
244
- link?: string;
245
- /** Link text */
246
- linkText?: string;
247
- }
248
- /**
249
- * Entry page frontmatter configuration.
250
- */
251
- interface EntryPageConfig {
252
- /** Layout type - set to 'entry' for entry page */
253
- layout: "entry";
254
- /** Hero section */
255
- hero?: HeroConfig;
256
- /** Feature cards */
257
- features?: FeatureConfig[];
258
- }
259
- /**
260
- * SSG (Static Site Generation) options.
261
- */
262
- interface SsgOptions {
263
- /**
264
- * Enable SSG mode.
265
- * @default true
266
- */
267
- enabled?: boolean;
268
- /**
269
- * Output file extension.
270
- * @default '.html'
271
- */
272
- extension?: string;
273
- /**
274
- * Clean output directory before build.
275
- * @default false
276
- */
277
- clean?: boolean;
278
- /**
279
- * Bare HTML output (no navigation, no styles).
280
- * Useful for benchmarking or when using custom layouts.
281
- * @default false
282
- */
283
- bare?: boolean;
284
- /**
285
- * Site name for header and title suffix.
286
- */
287
- siteName?: string;
288
- /**
289
- * OG image URL for social sharing (static URL).
290
- * If generateOgImage is enabled, this serves as the fallback.
291
- */
292
- ogImage?: string;
293
- /**
294
- * Generate OG images per page using Rust-based generator.
295
- * When enabled, each page will have a unique OG image.
296
- * @default false
297
- */
298
- generateOgImage?: boolean;
299
- /**
300
- * Site URL for generating absolute OG image URLs.
301
- * Required for proper SNS sharing.
302
- * Example: 'https://example.com'
303
- */
304
- siteUrl?: string;
305
- /**
306
- * Theme configuration for customizing the SSG output.
307
- * Use defineTheme() to create a theme configuration.
308
- */
309
- theme?: ThemeConfig;
310
- }
311
- /**
312
- * Resolved SSG options.
313
- */
314
- interface ResolvedSsgOptions {
315
- enabled: boolean;
316
- extension: string;
317
- clean: boolean;
318
- bare: boolean;
319
- siteName?: string;
320
- ogImage?: string;
321
- generateOgImage: boolean;
322
- siteUrl?: string;
323
- theme?: ResolvedThemeConfig;
324
- }
325
- /**
326
- * Plugin options.
327
- */
328
- interface OxContentOptions {
329
- /**
330
- * Source directory for Markdown files.
331
- * @default 'content'
332
- */
333
- srcDir?: string;
334
- /**
335
- * Output directory for built files.
336
- * @default 'dist'
337
- */
338
- outDir?: string;
339
- /**
340
- * Base path for the site.
341
- * @default '/'
342
- */
343
- base?: string;
344
- /**
345
- * SSG (Static Site Generation) options.
346
- * Set to false to disable SSG completely.
347
- * @default { enabled: true }
348
- */
349
- ssg?: SsgOptions | boolean;
350
- /**
351
- * Enable GitHub Flavored Markdown extensions.
352
- * @default true
353
- */
354
- gfm?: boolean;
355
- /**
356
- * Enable footnotes.
357
- * @default true
358
- */
359
- footnotes?: boolean;
360
- /**
361
- * Enable tables.
362
- * @default true
363
- */
364
- tables?: boolean;
365
- /**
366
- * Enable task lists.
367
- * @default true
368
- */
369
- taskLists?: boolean;
370
- /**
371
- * Enable strikethrough.
372
- * @default true
373
- */
374
- strikethrough?: boolean;
375
- /**
376
- * Enable syntax highlighting for code blocks.
377
- * @default false
378
- */
379
- highlight?: boolean;
380
- /**
381
- * Syntax highlighting theme.
382
- * @default 'github-dark'
383
- */
384
- highlightTheme?: string;
385
- /**
386
- * Additional languages for syntax highlighting.
387
- * Accepts Shiki LanguageRegistration objects (e.g., TextMate grammars).
388
- * These are loaded alongside the built-in languages.
389
- */
390
- highlightLangs?: LanguageRegistration$1[];
391
- /**
392
- * Enable mermaid diagram rendering.
393
- * @default false
394
- */
395
- mermaid?: boolean;
396
- /**
397
- * Parse YAML frontmatter.
398
- * @default true
399
- */
400
- frontmatter?: boolean;
401
- /**
402
- * Generate table of contents.
403
- * @default true
404
- */
405
- toc?: boolean;
406
- /**
407
- * Maximum heading depth for TOC.
408
- * @default 3
409
- */
410
- tocMaxDepth?: number;
411
- /**
412
- * Enable OG image generation.
413
- * @default false
414
- */
415
- ogImage?: boolean;
416
- /**
417
- * OG image generation options.
418
- */
419
- ogImageOptions?: OgImageOptions;
420
- /**
421
- * Custom AST transformers.
422
- */
423
- transformers?: MarkdownTransformer[];
424
- /**
425
- * Source documentation generation options.
426
- * Set to false to disable (opt-out).
427
- * @default { enabled: true }
428
- */
429
- docs?: DocsOptions | false;
430
- /**
431
- * Full-text search options.
432
- * Set to false to disable search.
433
- * @default { enabled: true }
434
- */
435
- search?: SearchOptions | boolean;
436
- /**
437
- * Enable OG Viewer dev tool.
438
- * Accessible at /__og-viewer during development.
439
- * @default true
440
- */
441
- ogViewer?: boolean;
442
- /**
443
- * i18n (internationalization) options.
444
- * Set to false to disable i18n.
445
- * @default false
446
- */
447
- i18n?: I18nOptions | false;
448
- }
449
- /**
450
- * Resolved options with all defaults applied.
451
- */
452
- interface ResolvedOptions {
453
- srcDir: string;
454
- outDir: string;
455
- base: string;
456
- ssg: ResolvedSsgOptions;
457
- gfm: boolean;
458
- footnotes: boolean;
459
- tables: boolean;
460
- taskLists: boolean;
461
- strikethrough: boolean;
462
- highlight: boolean;
463
- highlightTheme: string;
464
- highlightLangs: LanguageRegistration$1[];
465
- mermaid: boolean;
466
- frontmatter: boolean;
467
- toc: boolean;
468
- tocMaxDepth: number;
469
- ogImage: boolean;
470
- ogImageOptions: ResolvedOgImageOptions$1;
471
- transformers: MarkdownTransformer[];
472
- docs: ResolvedDocsOptions | false;
473
- search: ResolvedSearchOptions;
474
- ogViewer: boolean;
475
- i18n: ResolvedI18nOptions | false;
476
- }
477
- /**
478
- * OG image generation options.
479
- * Uses Chromium-based rendering with customizable templates.
480
- */
481
- interface OgImageOptions {
482
- /**
483
- * Path to a custom template file (.ts, .vue, .svelte, .tsx/.jsx).
484
- * - `.ts`: default-export a function `(props) => string`
485
- * - `.vue`: Vue SFC, rendered via SSR
486
- * - `.svelte`: Svelte SFC, rendered via SSR
487
- * - `.tsx`/`.jsx`: React Server Component, rendered via SSR
488
- * If not specified, the built-in default template is used.
489
- */
490
- template?: string;
491
- /**
492
- * Vue plugin to use for compiling `.vue` templates.
493
- * - `'vitejs'`: Use `@vue/compiler-sfc` (official, default)
494
- * - `'vizejs'`: Use `@vizejs/vite-plugin` (Rust-based)
495
- * @default 'vitejs'
496
- */
497
- vuePlugin?: "vitejs" | "vizejs";
498
- /**
499
- * Image width in pixels.
500
- * @default 1200
501
- */
502
- width?: number;
503
- /**
504
- * Image height in pixels.
505
- * @default 630
506
- */
507
- height?: number;
508
- /**
509
- * Enable content-hash based caching.
510
- * Skips rendering when content hasn't changed.
511
- * @default true
512
- */
513
- cache?: boolean;
514
- /**
515
- * Number of concurrent page instances for parallel rendering.
516
- * @default 1
517
- */
518
- concurrency?: number;
519
- }
520
- /**
521
- * Resolved OG image options with all defaults applied.
522
- */
523
- interface ResolvedOgImageOptions$1 {
524
- template?: string;
525
- vuePlugin: "vitejs" | "vizejs";
526
- width: number;
527
- height: number;
528
- cache: boolean;
529
- concurrency: number;
530
- }
531
- /**
532
- * Custom AST transformer.
533
- */
534
- interface MarkdownTransformer {
535
- /**
536
- * Transformer name.
537
- */
538
- name: string;
539
- /**
540
- * Transform function.
541
- */
542
- transform: (ast: MarkdownNode, context: TransformContext) => MarkdownNode | Promise<MarkdownNode>;
543
- }
544
- /**
545
- * Transform context passed to transformers.
546
- */
547
- interface TransformContext {
548
- /**
549
- * File path being processed.
550
- */
551
- filePath: string;
552
- /**
553
- * Frontmatter data.
554
- */
555
- frontmatter: Record<string, unknown>;
556
- /**
557
- * Resolved plugin options.
558
- */
559
- options: ResolvedOptions;
560
- }
561
- /**
562
- * Markdown AST node (simplified for TypeScript).
563
- */
564
- interface MarkdownNode {
565
- type: string;
566
- children?: MarkdownNode[];
567
- value?: string;
568
- [key: string]: unknown;
569
- }
570
- /**
571
- * Transform result.
572
- */
573
- interface TransformResult {
574
- /**
575
- * Generated JavaScript code.
576
- */
577
- code: string;
578
- /**
579
- * Source map (null means no source map).
580
- */
581
- map?: null;
582
- /**
583
- * Rendered HTML.
584
- */
585
- html: string;
586
- /**
587
- * Parsed frontmatter.
588
- */
589
- frontmatter: Record<string, unknown>;
590
- /**
591
- * Table of contents.
592
- */
593
- toc: TocEntry[];
594
- }
595
- /**
596
- * Table of contents entry.
597
- */
598
- interface TocEntry {
599
- /**
600
- * Heading depth (1-6).
601
- */
602
- depth: number;
603
- /**
604
- * Heading text.
605
- */
606
- text: string;
607
- /**
608
- * Slug/ID for linking.
609
- */
610
- slug: string;
611
- /**
612
- * Child entries.
613
- */
614
- children: TocEntry[];
615
- }
616
- /**
617
- * Options for source documentation generation.
618
- */
619
- interface DocsOptions {
620
- /**
621
- * Enable/disable docs generation.
622
- * @default true (opt-out)
623
- */
624
- enabled?: boolean;
625
- /**
626
- * Source directories to scan for documentation.
627
- * @default ['./src']
628
- */
629
- src?: string[];
630
- /**
631
- * Output directory for generated documentation.
632
- * @default 'docs/api'
633
- */
634
- out?: string;
635
- /**
636
- * Glob patterns for files to include.
637
- * @default ['**\/*.ts', '**\/*.tsx']
638
- */
639
- include?: string[];
640
- /**
641
- * Glob patterns for files to exclude.
642
- * @default ['**\/*.test.*', '**\/*.spec.*', 'node_modules']
643
- */
644
- exclude?: string[];
645
- /**
646
- * Output format.
647
- * @default 'markdown'
648
- */
649
- format?: "markdown" | "json" | "html";
650
- /**
651
- * Include private members in documentation.
652
- * @default false
653
- */
654
- private?: boolean;
655
- /**
656
- * Generate table of contents for each file.
657
- * @default true
658
- */
659
- toc?: boolean;
660
- /**
661
- * Group documentation by file or category.
662
- * @default 'file'
663
- */
664
- groupBy?: "file" | "category";
665
- /**
666
- * GitHub repository URL for source code links.
667
- * When provided, generated documentation will include links to source code.
668
- * Example: 'https://github.com/ubugeeei/ox-content'
669
- */
670
- githubUrl?: string;
671
- /**
672
- * Generate navigation metadata file.
673
- * @default true
674
- */
675
- generateNav?: boolean;
676
- }
677
- /**
678
- * Resolved docs options with all defaults applied.
679
- */
680
- interface ResolvedDocsOptions {
681
- enabled: boolean;
682
- src: string[];
683
- out: string;
684
- include: string[];
685
- exclude: string[];
686
- format: "markdown" | "json" | "html";
687
- private: boolean;
688
- toc: boolean;
689
- groupBy: "file" | "category";
690
- githubUrl?: string;
691
- generateNav: boolean;
692
- }
693
- /**
694
- * A single documentation entry extracted from source.
695
- */
696
- interface DocEntry {
697
- name: string;
698
- kind: "function" | "class" | "interface" | "type" | "variable" | "module";
699
- description: string;
700
- params?: ParamDoc[];
701
- returns?: ReturnDoc;
702
- examples?: string[];
703
- tags?: Record<string, string>;
704
- private?: boolean;
705
- file: string;
706
- line: number;
707
- signature?: string;
708
- }
709
- /**
710
- * Parameter documentation.
711
- */
712
- interface ParamDoc {
713
- name: string;
714
- type: string;
715
- description: string;
716
- optional?: boolean;
717
- default?: string;
718
- }
719
- /**
720
- * Return type documentation.
721
- */
722
- interface ReturnDoc {
723
- type: string;
724
- description: string;
725
- }
726
- /**
727
- * Extracted documentation for a single file.
728
- */
729
- interface ExtractedDocs {
730
- file: string;
731
- entries: DocEntry[];
732
- }
733
- /**
734
- * Navigation item for sidebar navigation.
735
- */
736
-
737
- /**
738
- * Options for full-text search.
739
- */
740
- interface SearchOptions {
741
- /**
742
- * Enable search functionality.
743
- * @default true
744
- */
745
- enabled?: boolean;
746
- /**
747
- * Maximum number of search results.
748
- * @default 10
749
- */
750
- limit?: number;
751
- /**
752
- * Enable prefix matching for autocomplete.
753
- * @default true
754
- */
755
- prefix?: boolean;
756
- /**
757
- * Placeholder text for the search input.
758
- * @default 'Search documentation...'
759
- */
760
- placeholder?: string;
761
- /**
762
- * Keyboard shortcut to focus search (without modifier).
763
- * @default '/'
764
- */
765
- hotkey?: string;
766
- }
767
- /**
768
- * Resolved search options.
769
- */
770
- interface ResolvedSearchOptions {
771
- enabled: boolean;
772
- limit: number;
773
- prefix: boolean;
774
- placeholder: string;
775
- hotkey: string;
776
- }
777
- /**
778
- * Search document structure.
779
- */
780
- interface SearchDocument {
781
- id: string;
782
- title: string;
783
- url: string;
784
- body: string;
785
- headings: string[];
786
- code: string[];
787
- }
788
- /**
789
- * Search result structure.
790
- */
791
- interface SearchResult {
792
- id: string;
793
- title: string;
794
- url: string;
795
- score: number;
796
- matches: string[];
797
- snippet: string;
798
- }
799
- /**
800
- * Locale configuration.
801
- */
802
- interface LocaleConfig {
803
- /** BCP 47 locale tag (e.g., 'en', 'ja', 'zh-Hans'). */
804
- code: string;
805
- /** Display name for this locale (e.g., 'English', '日本語'). */
806
- name: string;
807
- /** Text direction. @default 'ltr' */
808
- dir?: "ltr" | "rtl";
809
- }
810
- /**
811
- * i18n (internationalization) options.
812
- */
813
- interface I18nOptions {
814
- /**
815
- * Enable i18n.
816
- * @default false
817
- */
818
- enabled?: boolean;
819
- /**
820
- * Path to i18n dictionary directory (relative to project root).
821
- * @default 'content/i18n'
822
- */
823
- dir?: string;
824
- /**
825
- * Default locale tag.
826
- * @default 'en'
827
- */
828
- defaultLocale?: string;
829
- /**
830
- * Available locales.
831
- */
832
- locales?: LocaleConfig[];
833
- /**
834
- * Hide default locale prefix in URLs.
835
- * When true, `/page` serves the default locale and `/ja/page` serves Japanese.
836
- * When false, all locales get prefixed: `/en/page`, `/ja/page`.
837
- * @default true
838
- */
839
- hideDefaultLocale?: boolean;
840
- /**
841
- * Run i18n checks during build.
842
- * @default true
843
- */
844
- check?: boolean;
845
- /**
846
- * Translation function names to detect in source code.
847
- * @default ['t', '$t']
848
- */
849
- functionNames?: string[];
850
- }
851
- /**
852
- * Resolved i18n options with all defaults applied.
853
- */
854
- interface ResolvedI18nOptions {
855
- enabled: boolean;
856
- dir: string;
857
- defaultLocale: string;
858
- locales: LocaleConfig[];
859
- hideDefaultLocale: boolean;
860
- check: boolean;
861
- functionNames: string[];
862
- }
863
- //# sourceMappingURL=types.d.ts.map
864
- //#endregion
865
- //#region src/environment.d.ts
866
- /**
867
- * Creates the Markdown processing environment configuration.
868
- *
869
- * This environment is used for:
870
- * - Server-side rendering of Markdown files
871
- * - Static site generation
872
- * - Pre-rendering at build time
873
- *
874
- * @example
875
- * ```ts
876
- * // In your vite.config.ts
877
- * export default defineConfig({
878
- * environments: {
879
- * markdown: createMarkdownEnvironment({
880
- * srcDir: 'content',
881
- * gfm: true,
882
- * }),
883
- * },
884
- * });
885
- * ```
886
- */
887
- declare function createMarkdownEnvironment(options: ResolvedOptions): EnvironmentOptions;
888
- /**
889
- * Environment-specific module transformer.
890
- *
891
- * This is called during the transform phase to process
892
- * Markdown files within the environment context.
893
- */
894
-
895
- //#endregion
896
- //#region src/transform.d.ts
897
- /**
898
- * Transforms Markdown content into a JavaScript module.
899
- *
900
- * This is the primary entry point for transforming Markdown files. It handles
901
- * the complete transformation pipeline including parsing, rendering, syntax
902
- * highlighting, and code generation.
903
- *
904
- * ## Pipeline Steps
905
- *
906
- * 1. **Parse & Render**: Uses Rust-based parser via NAPI for high performance
907
- * 2. **Extract Metadata**: Parses YAML frontmatter and generates table of contents
908
- * 3. **Enhance HTML**: Applies syntax highlighting and Mermaid diagram rendering
909
- * 4. **Generate Code**: Creates importable JavaScript module
910
- *
911
- * ## Generated Module Exports
912
- *
913
- * - `html` (string): Rendered HTML content with all enhancements applied
914
- * - `frontmatter` (object): Parsed YAML frontmatter as JavaScript object
915
- * - `toc` (array): Hierarchical table of contents entries
916
- * - `render` (function): Client-side render function for dynamic updates
917
- *
918
- * ## Markdown Features Supported
919
- *
920
- * The supported features depend on parser options:
921
- * - **Commonmark**: Headings, paragraphs, lists, code blocks, links, images
922
- * - **GFM Extensions**: Tables, task lists, strikethrough, autolinks
923
- * - **Enhancements**: Syntax highlighting, Mermaid diagrams, TOC generation
924
- * - **Metadata**: YAML frontmatter parsing
925
- *
926
- * ## Performance
927
- *
928
- * Uses Rust-based parsing via NAPI bindings for optimal performance. Falls back
929
- * gracefully if Rust bindings are unavailable.
930
- *
931
- * @param source - Raw Markdown source code (may include YAML frontmatter)
932
- * @param filePath - File path for source attribution and relative link resolution
933
- * @param options - Resolved plugin options controlling transformation behavior
934
- *
935
- * @returns Promise resolving to transformation result with HTML and metadata
936
- *
937
- * @throws Error if NAPI bindings are unavailable (can be handled gracefully)
938
- *
939
- * @example
940
- * ```typescript
941
- * import { transformMarkdown } from './transform';
942
- * import { resolveOptions } from './index';
943
- *
944
- * // Transform a Markdown file with YAML frontmatter
945
- * const markdown = `---
946
- * title: Getting Started
947
- * author: john
948
- * ---
949
- *
950
- * # Getting Started
951
- *
952
- * Welcome! This guide explains [transformMarkdown] function.
953
- *
954
- * ## Installation
955
- *
956
- * \`\`\`bash
957
- * npm install @ox-content/vite-plugin
958
- * \`\`\`
959
- * `;
960
- *
961
- * const options = resolveOptions({
962
- * highlight: true,
963
- * highlightTheme: 'github-dark',
964
- * toc: true,
965
- * gfm: true,
966
- * mermaid: true,
967
- * });
968
- *
969
- * const result = await transformMarkdown(markdown, 'docs/getting-started.md', options);
970
- *
971
- * // Generated module exports
972
- * console.log(result.html); // Rendered HTML with syntax highlighting
973
- * console.log(result.frontmatter); // { title: 'Getting Started', author: 'john' }
974
- * console.log(result.toc); // [{ depth: 1, text: 'Getting Started', ... }]
975
- * console.log(result.code); // ES module export statement
976
- * ```
977
- */
978
- /**
979
- * SSG-specific transform options.
980
- */
981
- interface SsgTransformOptions {
982
- /** Convert `.md` links to `.html` links */
983
- convertMdLinks?: boolean;
984
- /** Base URL for absolute link conversion */
985
- baseUrl?: string;
986
- /** Source file path for relative link resolution */
987
- sourcePath?: string;
988
- }
989
- declare function transformMarkdown(source: string, filePath: string, options: ResolvedOptions, ssgOptions?: SsgTransformOptions): Promise<TransformResult>;
990
- /**
991
- * Extracts imports from Markdown content.
992
- *
993
- * Supports importing components for interactive islands.
994
- */
995
- //#endregion
996
- //#region src/docs.d.ts
997
- /**
998
- * Extracts JSDoc documentation from source files in specified directories.
999
- *
1000
- * This function recursively searches directories for source files matching
1001
- * the include/exclude patterns, then extracts all documented items (functions,
1002
- * classes, interfaces, types) from those files.
1003
- *
1004
- * ## Process
1005
- *
1006
- * 1. **File Discovery**: Recursively walks directories, applying filters
1007
- * 2. **File Reading**: Loads each matching file's content
1008
- * 3. **JSDoc Extraction**: Parses JSDoc comments using regex patterns
1009
- * 4. **Declaration Matching**: Pairs JSDoc comments with source declarations
1010
- * 5. **Result Collection**: Aggregates extracted documentation by file
1011
- *
1012
- * ## Include/Exclude Patterns
1013
- *
1014
- * Patterns support:
1015
- * - `**` - Match any directory structure
1016
- * - `*` - Match any filename
1017
- * - Standard glob patterns (e.g., `**\/*.test.ts`)
1018
- *
1019
- * ## Performance Considerations
1020
- *
1021
- * - Uses filesystem I/O which can be slow for large codebases
1022
- * - Consider using more specific include patterns to reduce file scanning
1023
- * - Results are not cached; call once per build/dev session
1024
- *
1025
- * @param srcDirs - Array of source directory paths to scan
1026
- * @param options - Documentation extraction options (filters, grouping, etc.)
1027
- *
1028
- * @returns Promise resolving to array of extracted documentation by file.
1029
- * Each ExtractedDocs object contains file path and array of DocEntry items.
1030
- *
1031
- * @example
1032
- * ```typescript
1033
- * const docs = await extractDocs(
1034
- * ['./packages/vite-plugin/src'],
1035
- * {
1036
- * enabled: true,
1037
- * src: [],
1038
- * out: 'docs',
1039
- * include: ['**\/*.ts'],
1040
- * exclude: ['**\/*.test.ts', '**\/*.spec.ts'],
1041
- * format: 'markdown',
1042
- * private: false,
1043
- * toc: true,
1044
- * groupBy: 'file',
1045
- * generateNav: true,
1046
- * }
1047
- * );
1048
- *
1049
- * // Returns:
1050
- * // [
1051
- * // {
1052
- * // file: '/path/to/transform.ts',
1053
- * // entries: [
1054
- * // { name: 'transformMarkdown', kind: 'function', ... },
1055
- * // { name: 'loadNapiBindings', kind: 'function', ... },
1056
- * // ]
1057
- * // },
1058
- * // ...
1059
- * // ]
1060
- * ```
1061
- */
1062
- declare function extractDocs(srcDirs: string[], options: ResolvedDocsOptions): Promise<ExtractedDocs[]>;
1063
- /**
1064
- * Generates Markdown documentation from extracted docs.
1065
- */
1066
- declare function generateMarkdown(docs: ExtractedDocs[], options: ResolvedDocsOptions): Record<string, string>;
1067
- /**
1068
- * Writes generated documentation to the output directory.
1069
- */
1070
- declare function writeDocs(docs: Record<string, string>, outDir: string, extractedDocs?: ExtractedDocs[], options?: ResolvedDocsOptions): Promise<void>;
1071
- declare function resolveDocsOptions(options: DocsOptions | false | undefined): ResolvedDocsOptions | false;
1072
- //# sourceMappingURL=docs.d.ts.map
1073
- //#endregion
1074
- //#region src/ssg.d.ts
1075
- /**
1076
- * Default HTML template for SSG pages with navigation.
1077
- */
1078
- declare const DEFAULT_HTML_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{title}}{{#siteName}} - {{siteName}}{{/siteName}}</title>\n {{#description}}<meta name=\"description\" content=\"{{description}}\">{{/description}}\n <!-- Open Graph -->\n <meta property=\"og:type\" content=\"website\">\n <meta property=\"og:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta property=\"og:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta property=\"og:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <!-- Twitter Card -->\n {{#ogImage}}<meta name=\"twitter:card\" content=\"summary_large_image\">{{/ogImage}}\n {{^ogImage}}<meta name=\"twitter:card\" content=\"summary\">{{/ogImage}}\n <meta name=\"twitter:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta name=\"twitter:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta name=\"twitter:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <style>\n :root {\n --sidebar-width: 260px;\n --header-height: 60px;\n --max-content-width: 960px;\n --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n --color-bg: #ffffff;\n --color-bg-alt: #f8f9fa;\n --color-text: #1a1a1a;\n --color-text-muted: #666666;\n --color-border: #e5e7eb;\n --color-primary: #b7410e;\n --color-primary-hover: #ce5937;\n --color-code-bg: #1e293b;\n --color-code-text: #e2e8f0;\n }\n [data-theme=\"dark\"] {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n }\n * { box-sizing: border-box; margin: 0; padding: 0; }\n html { scroll-behavior: smooth; }\n body {\n font-family: var(--font-sans);\n line-height: 1.7;\n color: var(--color-text);\n background: var(--color-bg);\n }\n a { color: var(--color-primary); text-decoration: none; }\n a:hover { color: var(--color-primary-hover); text-decoration: underline; }\n\n /* Header */\n .header {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: var(--header-height);\n background: var(--color-bg);\n border-bottom: 1px solid var(--color-border);\n display: flex;\n align-items: center;\n padding: 0 1.5rem;\n z-index: 100;\n }\n .header-title {\n font-size: 1.25rem;\n font-weight: 600;\n color: var(--color-text);\n }\n .header-title:hover { text-decoration: none; }\n .menu-toggle {\n display: none;\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n margin-right: 0.75rem;\n }\n .menu-toggle svg { display: block; }\n .menu-toggle path { stroke: var(--color-text); }\n .header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }\n .search-button {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 6px;\n color: var(--color-text-muted);\n cursor: pointer;\n font-size: 0.875rem;\n transition: border-color 0.15s, color 0.15s;\n }\n .search-button:hover { border-color: var(--color-primary); color: var(--color-text); }\n .search-button svg { width: 16px; height: 16px; }\n .search-button kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n font-size: 0.75rem;\n }\n @media (max-width: 640px) {\n .search-button span, .search-button kbd { display: none; }\n .search-button { padding: 0.5rem; }\n }\n .search-modal-overlay {\n display: none;\n position: fixed;\n inset: 0;\n z-index: 200;\n background: rgba(0,0,0,0.6);\n backdrop-filter: blur(4px);\n justify-content: center;\n padding-top: 10vh;\n }\n .search-modal-overlay.open { display: flex; }\n .search-modal {\n width: 100%;\n max-width: 560px;\n margin: 0 1rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);\n max-height: 70vh;\n display: flex;\n flex-direction: column;\n }\n .search-header {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n padding: 1rem;\n border-bottom: 1px solid var(--color-border);\n }\n .search-header svg { flex-shrink: 0; color: var(--color-text-muted); }\n .search-input {\n flex: 1;\n background: none;\n border: none;\n outline: none;\n font-size: 1rem;\n color: var(--color-text);\n }\n .search-input::placeholder { color: var(--color-text-muted); }\n .search-close {\n padding: 0.25rem 0.5rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n color: var(--color-text-muted);\n font-family: var(--font-mono);\n font-size: 0.75rem;\n cursor: pointer;\n }\n .search-results {\n flex: 1;\n overflow-y: auto;\n padding: 0.5rem;\n }\n .search-result {\n display: block;\n padding: 0.75rem 1rem;\n border-radius: 8px;\n color: var(--color-text);\n text-decoration: none;\n }\n .search-result:hover, .search-result.selected { background: var(--color-bg-alt); text-decoration: none; }\n .search-result-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }\n .search-result-snippet { font-size: 0.8125rem; color: var(--color-text-muted); }\n .search-empty { padding: 2rem 1rem; text-align: center; color: var(--color-text-muted); }\n .search-footer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 1rem;\n padding: 0.75rem 1rem;\n border-top: 1px solid var(--color-border);\n background: var(--color-bg-alt);\n font-size: 0.75rem;\n color: var(--color-text-muted);\n }\n .search-footer kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n }\n .theme-toggle {\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n border-radius: 6px;\n color: var(--color-text-muted);\n transition: background 0.15s, color 0.15s;\n }\n .theme-toggle:hover { background: var(--color-bg-alt); color: var(--color-text); }\n .theme-toggle svg { display: block; width: 20px; height: 20px; }\n .theme-toggle .icon-sun { display: none; }\n .theme-toggle .icon-moon { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-sun { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-moon { display: none; }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-sun { display: block; }\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-moon { display: none; }\n }\n\n /* Layout */\n .layout {\n display: flex;\n padding-top: var(--header-height);\n min-height: 100vh;\n }\n\n /* Sidebar */\n .sidebar {\n position: fixed;\n top: var(--header-height);\n left: 0;\n bottom: 0;\n width: var(--sidebar-width);\n background: var(--color-bg-alt);\n border-right: 1px solid var(--color-border);\n overflow-y: auto;\n padding: 1.5rem 1rem;\n }\n .nav-section { margin-bottom: 1.5rem; }\n .nav-title {\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--color-text-muted);\n margin-bottom: 0.5rem;\n padding: 0 0.75rem;\n }\n .nav-list { list-style: none; }\n .nav-item { margin: 0.125rem 0; }\n .nav-link {\n display: block;\n padding: 0.5rem 0.75rem;\n border-radius: 6px;\n color: var(--color-text);\n font-size: 0.875rem;\n transition: background 0.15s;\n }\n .nav-link:hover {\n background: var(--color-border);\n text-decoration: none;\n }\n .nav-link.active {\n background: var(--color-primary);\n color: white;\n }\n\n /* Main content */\n .main {\n flex: 1;\n margin-left: var(--sidebar-width);\n padding: 2rem;\n min-width: 0;\n overflow-x: hidden;\n }\n .content {\n max-width: var(--max-content-width);\n margin: 0 auto;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n /* TOC (right sidebar) */\n .toc {\n position: fixed;\n top: calc(var(--header-height) + 2rem);\n right: 2rem;\n width: 200px;\n font-size: 0.8125rem;\n }\n .toc-title {\n font-weight: 600;\n margin-bottom: 0.75rem;\n color: var(--color-text-muted);\n }\n .toc-list { list-style: none; }\n .toc-item { margin: 0.375rem 0; }\n .toc-link {\n color: var(--color-text-muted);\n display: block;\n padding-left: calc((var(--depth, 1) - 1) * 0.75rem);\n }\n .toc-link:hover { color: var(--color-primary); }\n @media (max-width: 1200px) { .toc { display: none; } }\n\n /* Typography */\n .content h1 { font-size: 2.25rem; margin-bottom: 1rem; line-height: 1.2; }\n .content h2 { font-size: 1.5rem; margin-top: 2.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); }\n .content h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }\n .content h4 { font-size: 1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }\n .content p { margin-bottom: 1rem; }\n .content ul, .content ol { margin: 1rem 0; padding-left: 1.5rem; }\n .content li { margin: 0.375rem 0; }\n .content blockquote {\n border-left: 4px solid var(--color-primary);\n padding: 0.5rem 1rem;\n margin: 1rem 0;\n background: var(--color-bg-alt);\n border-radius: 0 6px 6px 0;\n }\n .content code {\n font-family: var(--font-mono);\n font-size: 0.875em;\n background: var(--color-bg-alt);\n padding: 0.2em 0.4em;\n border-radius: 4px;\n word-break: break-all;\n }\n .content pre {\n background: var(--color-code-bg);\n color: var(--color-code-text);\n padding: 1rem 1.25rem;\n border-radius: 8px;\n overflow-x: auto;\n margin: 1.5rem 0;\n line-height: 1.5;\n }\n .content pre code {\n background: transparent;\n padding: 0;\n font-size: 0.8125rem;\n }\n .content table {\n width: 100%;\n border-collapse: collapse;\n margin: 1.5rem 0;\n font-size: 0.875rem;\n }\n .content th, .content td {\n border: 1px solid var(--color-border);\n padding: 0.75rem 1rem;\n text-align: left;\n }\n .content th { background: var(--color-bg-alt); font-weight: 600; }\n .content img { max-width: 100%; height: auto; border-radius: 8px; display: block; }\n .content img[alt*=\"Logo\"] { max-width: 200px; display: block; margin: 1rem 0; }\n .content img[alt*=\"Architecture\"] { max-width: 600px; }\n .content img[alt*=\"Benchmark\"] { max-width: 680px; }\n .content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }\n\n /* Responsive */\n @media (max-width: 768px) {\n .menu-toggle { display: block; }\n .sidebar {\n transform: translateX(-100%);\n transition: transform 0.3s ease;\n z-index: 99;\n width: 280px;\n }\n .sidebar.open { transform: translateX(0); }\n .main { margin-left: 0; padding: 1rem 0.75rem; }\n .content { padding: 0 0.25rem; }\n .content h1 { font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.75rem; }\n .content h2 { font-size: 1.2rem; margin-top: 2rem; }\n .content h3 { font-size: 1.1rem; }\n .content p { font-size: 0.9375rem; margin-bottom: 0.875rem; }\n .content ul, .content ol { padding-left: 1.25rem; font-size: 0.9375rem; }\n .content pre {\n padding: 0.75rem;\n font-size: 0.75rem;\n margin: 1rem -0.75rem;\n border-radius: 0;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n .content code { font-size: 0.8125em; }\n .content table {\n display: block;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n font-size: 0.8125rem;\n margin: 1rem -0.75rem;\n width: calc(100% + 1.5rem);\n }\n .content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; }\n .content img { margin: 1rem 0; }\n .content img[alt*=\"Logo\"] { max-width: 150px; }\n .content img[alt*=\"Architecture\"] { max-width: 100%; }\n .content img[alt*=\"Benchmark\"] { max-width: 100%; }\n .content blockquote { padding: 0.5rem 0.75rem; margin: 1rem 0; font-size: 0.9375rem; }\n .header { padding: 0 1rem; }\n .header-title { font-size: 1rem; }\n .header-title img { width: 24px; height: 24px; }\n .overlay {\n display: none;\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.5);\n z-index: 98;\n }\n .overlay.open { display: block; }\n }\n\n /* Extra small devices */\n @media (max-width: 480px) {\n .main { padding: 0.75rem 0.5rem; }\n .content h1 { font-size: 1.35rem; }\n .content pre { font-size: 0.6875rem; padding: 0.625rem; }\n .content table { font-size: 0.75rem; }\n .content th, .content td { padding: 0.375rem 0.5rem; }\n }\n </style>\n</head>\n<body>\n <header class=\"header\">\n <button class=\"menu-toggle\" aria-label=\"Toggle menu\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M3 12h18M3 6h18M3 18h18\"/>\n </svg>\n </button>\n <a href=\"{{base}}index.html\" class=\"header-title\">\n <img src=\"{{base}}logo.svg\" alt=\"\" width=\"28\" height=\"28\" style=\"margin-right: 8px; vertical-align: middle;\" />\n {{siteName}}\n </a>\n <div class=\"header-actions\">\n <button class=\"search-button\" aria-label=\"Search\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <span>Search</span>\n <kbd>/</kbd>\n </button>\n <button class=\"theme-toggle\" aria-label=\"Toggle theme\">\n <svg class=\"icon-sun\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"5\"/><path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\"/>\n </svg>\n <svg class=\"icon-moon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"/>\n </svg>\n </button>\n </div>\n </header>\n <div class=\"search-modal-overlay\">\n <div class=\"search-modal\">\n <div class=\"search-header\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <input type=\"text\" class=\"search-input\" placeholder=\"Search documentation...\" />\n <button class=\"search-close\">Esc</button>\n </div>\n <div class=\"search-results\"></div>\n <div class=\"search-footer\">\n <span><kbd>\u2191</kbd><kbd>\u2193</kbd> to navigate</span>\n <span><kbd>Enter</kbd> to select</span>\n <span><kbd>Esc</kbd> to close</span>\n </div>\n </div>\n </div>\n <div class=\"overlay\"></div>\n <div class=\"layout\">\n <aside class=\"sidebar\">\n <nav>\n{{navigation}}\n </nav>\n </aside>\n <main class=\"main\">\n <article class=\"content\">\n{{content}}\n </article>\n </main>\n{{#hasToc}}\n <aside class=\"toc\">\n <div class=\"toc-title\">On this page</div>\n <ul class=\"toc-list\">\n{{toc}}\n </ul>\n </aside>\n{{/hasToc}}\n </div>\n <script>\n // Menu toggle\n const toggle = document.querySelector('.menu-toggle');\n const sidebar = document.querySelector('.sidebar');\n const overlay = document.querySelector('.overlay');\n if (toggle && sidebar && overlay) {\n const close = () => { sidebar.classList.remove('open'); overlay.classList.remove('open'); };\n toggle.addEventListener('click', () => {\n sidebar.classList.toggle('open');\n overlay.classList.toggle('open');\n });\n overlay.addEventListener('click', close);\n sidebar.querySelectorAll('a').forEach(a => a.addEventListener('click', close));\n }\n\n // Theme toggle\n const themeToggle = document.querySelector('.theme-toggle');\n const getPreferredTheme = () => {\n const stored = localStorage.getItem('theme');\n if (stored) return stored;\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n };\n const setTheme = (theme) => {\n document.documentElement.setAttribute('data-theme', theme);\n localStorage.setItem('theme', theme);\n };\n // Initialize theme\n setTheme(getPreferredTheme());\n if (themeToggle) {\n themeToggle.addEventListener('click', () => {\n const current = document.documentElement.getAttribute('data-theme') || getPreferredTheme();\n setTheme(current === 'dark' ? 'light' : 'dark');\n });\n }\n\n // Search functionality\n const searchButton = document.querySelector('.search-button');\n const searchOverlay = document.querySelector('.search-modal-overlay');\n const searchInput = document.querySelector('.search-input');\n const searchResults = document.querySelector('.search-results');\n const searchClose = document.querySelector('.search-close');\n let searchIndex = null;\n let selectedIndex = 0;\n let results = [];\n\n const openSearch = () => {\n searchOverlay.classList.add('open');\n searchInput.focus();\n };\n const closeSearch = () => {\n searchOverlay.classList.remove('open');\n searchInput.value = '';\n searchResults.innerHTML = '';\n selectedIndex = 0;\n results = [];\n };\n\n // Load search index\n const loadSearchIndex = async () => {\n if (searchIndex) return;\n try {\n const res = await fetch('{{base}}search-index.json');\n searchIndex = await res.json();\n } catch (e) {\n console.warn('Failed to load search index:', e);\n }\n };\n\n // Tokenize query\n const tokenize = (text) => {\n const tokens = [];\n let current = '';\n for (const char of text) {\n const isCjk = /[\\u4E00-\\u9FFF\\u3400-\\u4DBF\\u3040-\\u309F\\u30A0-\\u30FF\\uAC00-\\uD7AF]/.test(char);\n if (isCjk) {\n if (current) { tokens.push(current.toLowerCase()); current = ''; }\n tokens.push(char);\n } else if (/[a-zA-Z0-9_]/.test(char)) {\n current += char;\n } else if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n }\n if (current) tokens.push(current.toLowerCase());\n return tokens;\n };\n\n // Perform search\n const performSearch = async (query) => {\n if (!query.trim()) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n await loadSearchIndex();\n if (!searchIndex) {\n searchResults.innerHTML = '<div class=\"search-empty\">Search index not available</div>';\n return;\n }\n\n const tokens = tokenize(query);\n if (!tokens.length) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n\n const k1 = 1.2, b = 0.75;\n const docScores = new Map();\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const isLast = i === tokens.length - 1;\n let matchingTerms = [];\n if (isLast && token.length >= 2) {\n matchingTerms = Object.keys(searchIndex.index).filter(t => t.startsWith(token));\n } else if (searchIndex.index[token]) {\n matchingTerms = [token];\n }\n\n for (const term of matchingTerms) {\n const postings = searchIndex.index[term] || [];\n const df = searchIndex.df[term] || 1;\n const idf = Math.log((searchIndex.doc_count - df + 0.5) / (df + 0.5) + 1.0);\n\n for (const posting of postings) {\n const doc = searchIndex.documents[posting.doc_idx];\n if (!doc) continue;\n const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;\n const tf = posting.tf;\n const docLen = doc.body.length;\n const score = idf * ((tf * (k1 + 1)) / (tf + k1 * (1 - b + b * docLen / searchIndex.avg_dl))) * boost;\n\n if (!docScores.has(posting.doc_idx)) {\n docScores.set(posting.doc_idx, { score: 0, matches: new Set() });\n }\n const entry = docScores.get(posting.doc_idx);\n entry.score += score;\n entry.matches.add(term);\n }\n }\n }\n\n results = Array.from(docScores.entries())\n .map(([docIdx, data]) => {\n const doc = searchIndex.documents[docIdx];\n let snippet = '';\n if (doc.body) {\n const bodyLower = doc.body.toLowerCase();\n let firstPos = -1;\n for (const match of data.matches) {\n const pos = bodyLower.indexOf(match);\n if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;\n }\n const start = Math.max(0, firstPos - 50);\n const end = Math.min(doc.body.length, start + 150);\n snippet = doc.body.slice(start, end);\n if (start > 0) snippet = '...' + snippet;\n if (end < doc.body.length) snippet += '...';\n }\n return { ...doc, score: data.score, snippet };\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, 10);\n\n selectedIndex = 0;\n renderResults();\n };\n\n const renderResults = () => {\n if (!results.length) {\n searchResults.innerHTML = '<div class=\"search-empty\">No results found</div>';\n return;\n }\n searchResults.innerHTML = results.map((r, i) =>\n '<a href=\"' + r.url + '\" class=\"search-result' + (i === selectedIndex ? ' selected' : '') + '\">' +\n '<div class=\"search-result-title\">' + r.title + '</div>' +\n (r.snippet ? '<div class=\"search-result-snippet\">' + r.snippet + '</div>' : '') +\n '</a>'\n ).join('');\n };\n\n // Event listeners\n if (searchButton) searchButton.addEventListener('click', openSearch);\n if (searchClose) searchClose.addEventListener('click', closeSearch);\n if (searchOverlay) searchOverlay.addEventListener('click', (e) => { if (e.target === searchOverlay) closeSearch(); });\n\n let searchTimeout = null;\n if (searchInput) {\n searchInput.addEventListener('input', () => {\n if (searchTimeout) clearTimeout(searchTimeout);\n searchTimeout = setTimeout(() => performSearch(searchInput.value), 150);\n });\n searchInput.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') closeSearch();\n else if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (selectedIndex < results.length - 1) { selectedIndex++; renderResults(); }\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (selectedIndex > 0) { selectedIndex--; renderResults(); }\n } else if (e.key === 'Enter' && results[selectedIndex]) {\n e.preventDefault();\n window.location.href = results[selectedIndex].url;\n }\n });\n }\n\n // Global keyboard shortcut (/ or Cmd+K)\n document.addEventListener('keydown', (e) => {\n if ((e.key === '/' && !(e.target instanceof HTMLInputElement)) ||\n ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k')) {\n e.preventDefault();\n openSearch();\n }\n });\n </script>\n</body>\n</html>";
1079
- /**
1080
- * Bare HTML template (no navigation, no styles).
1081
- */
1082
-
1083
- /**
1084
- * Resolves SSG options with defaults.
1085
- */
1086
- declare function resolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptions;
1087
- /**
1088
- * Extracts title from content or frontmatter.
1089
- */
1090
-
1091
- /**
1092
- * Builds all markdown files to static HTML.
1093
- */
1094
- declare function buildSsg(options: ResolvedOptions, root: string): Promise<{
1095
- files: string[];
1096
- errors: string[];
1097
- }>;
1098
- //# sourceMappingURL=ssg.d.ts.map
1099
- //#endregion
1100
- //#region src/search.d.ts
1101
- /**
1102
- * Resolves search options with defaults.
1103
- */
1104
- declare function resolveSearchOptions(options: SearchOptions | boolean | undefined): ResolvedSearchOptions;
1105
- /**
1106
- * Builds the search index from Markdown files.
1107
- */
1108
- declare function buildSearchIndex(srcDir: string, base: string): Promise<string>;
1109
- /**
1110
- * Writes the search index to a file.
1111
- */
1112
- declare function writeSearchIndex(indexJson: string, outDir: string): Promise<void>;
1113
- /**
1114
- * Client-side search module code.
1115
- * This is injected into the bundle as a virtual module.
1116
- */
1117
-
1118
- //#endregion
1119
- //#region src/jsx-runtime.d.ts
1120
- /**
1121
- * Custom JSX Runtime for Static HTML Generation
1122
- *
1123
- * This module provides a JSX runtime that outputs static HTML strings.
1124
- * No React, no hydration, no client-side JavaScript - just pure HTML.
1125
- *
1126
- * @example
1127
- * ```tsx
1128
- * // tsconfig.json or vite.config.ts
1129
- * {
1130
- * "compilerOptions": {
1131
- * "jsx": "react-jsx",
1132
- * "jsxImportSource": "@ox-content/vite-plugin"
1133
- * }
1134
- * }
1135
- *
1136
- * // MyComponent.tsx
1137
- * export function Hero({ title }: { title: string }) {
1138
- * return (
1139
- * <section class="hero">
1140
- * <h1>{title}</h1>
1141
- * </section>
1142
- * );
1143
- * }
1144
- * ```
1145
- */
1146
- /**
1147
- * JSX element type - either a string (intrinsic) or a function component.
1148
- */
1149
- type JSXElementType = string | ((props: Record<string, unknown>) => JSXNode);
1150
- /**
1151
- * Valid JSX child types.
1152
- */
1153
- type JSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[];
1154
- /**
1155
- * JSX node - the result of JSX expressions.
1156
- */
1157
- interface JSXNode {
1158
- __html: string;
1159
- }
1160
- /**
1161
- * Props with children.
1162
- */
1163
- interface JSXProps {
1164
- children?: JSXChild;
1165
- [key: string]: unknown;
1166
- }
1167
- /**
1168
- * Creates a JSX element.
1169
- * This is the core function called by the JSX transform.
1170
- */
1171
- declare function jsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNode;
1172
- /**
1173
- * Creates a JSX element with static children.
1174
- * Called by the JSX transform for elements with multiple children.
1175
- */
1176
- declare function jsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNode;
1177
- /**
1178
- * Fragment component - renders children without a wrapper element.
1179
- */
1180
- declare function Fragment({
1181
- children
1182
- }: {
1183
- children?: JSXChild;
1184
- }): JSXNode;
1185
- /**
1186
- * Renders a JSX node to an HTML string.
1187
- */
1188
- declare function renderToString(node: JSXNode): string;
1189
- /**
1190
- * Creates raw HTML without escaping.
1191
- * Use with caution - only for trusted content.
1192
- *
1193
- * @example
1194
- * ```tsx
1195
- * <div>{raw('<strong>Bold</strong>')}</div>
1196
- * ```
1197
- */
1198
- declare function raw(html: string): JSXNode;
1199
- /**
1200
- * Conditionally renders content.
1201
- *
1202
- * @example
1203
- * ```tsx
1204
- * {when(isLoggedIn, <UserMenu />)}
1205
- * ```
1206
- */
1207
- declare function when(condition: boolean, content: JSXNode): JSXNode;
1208
- /**
1209
- * Maps over an array and renders each item.
1210
- *
1211
- * @example
1212
- * ```tsx
1213
- * {each(items, (item) => <li>{item.name}</li>)}
1214
- * ```
1215
- */
1216
- declare function each<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNode;
1217
- //#endregion
1218
- //#region src/page-context.d.ts
1219
- /**
1220
- * Base page props available for all pages.
1221
- */
1222
- interface BasePageProps {
1223
- /** Page title from frontmatter or first heading */
1224
- title: string;
1225
- /** Page description from frontmatter */
1226
- description?: string;
1227
- /** Rendered HTML content */
1228
- html: string;
1229
- /** Table of contents entries */
1230
- toc: TocEntry[];
1231
- /** Source file path (relative to docs root) */
1232
- path: string;
1233
- /** Output URL path */
1234
- url: string;
1235
- /** Raw frontmatter object */
1236
- frontmatter: Record<string, unknown>;
1237
- /** Layout name from frontmatter */
1238
- layout?: string;
1239
- }
1240
- /**
1241
- * Extended page props with custom frontmatter.
1242
- */
1243
- type PageProps<T extends Record<string, unknown> = Record<string, unknown>> = BasePageProps & {
1244
- /** Custom frontmatter fields */
1245
- frontmatter: T & Record<string, unknown>;
1246
- };
1247
- /**
1248
- * Site-wide configuration available in context.
1249
- */
1250
- interface SiteConfig {
1251
- /** Site name */
1252
- name: string;
1253
- /** Base URL path */
1254
- base: string;
1255
- /** All pages in the site */
1256
- pages: BasePageProps[];
1257
- /** Navigation groups */
1258
- nav: NavGroup[];
1259
- }
1260
- /**
1261
- * Navigation group.
1262
- */
1263
- interface NavGroup {
1264
- title: string;
1265
- items: NavItem[];
1266
- }
1267
- /**
1268
- * Navigation item.
1269
- */
1270
- interface NavItem {
1271
- title: string;
1272
- path: string;
1273
- href: string;
1274
- }
1275
- /**
1276
- * Complete render context.
1277
- */
1278
- interface RenderContext<T extends Record<string, unknown> = Record<string, unknown>> {
1279
- /** Current page props */
1280
- page: PageProps<T>;
1281
- /** Site configuration */
1282
- site: SiteConfig;
1283
- }
1284
- /**
1285
- * Sets the current render context.
1286
- * Called internally during page rendering.
1287
- * @internal
1288
- */
1289
- declare function setRenderContext(ctx: RenderContext): void;
1290
- /**
1291
- * Clears the current render context.
1292
- * Called internally after page rendering.
1293
- * @internal
1294
- */
1295
- declare function clearRenderContext(): void;
1296
- /**
1297
- * Gets the current page props.
1298
- *
1299
- * @returns The current page props
1300
- * @throws Error if called outside of a render context
1301
- *
1302
- * @example
1303
- * ```tsx
1304
- * function PageTitle() {
1305
- * const page = usePageProps();
1306
- * return <h1>{page.title}</h1>;
1307
- * }
1308
- * ```
1309
- */
1310
- declare function usePageProps<T extends Record<string, unknown> = Record<string, unknown>>(): PageProps<T>;
1311
- /**
1312
- * Gets the site configuration.
1313
- *
1314
- * @returns The site configuration
1315
- * @throws Error if called outside of a render context
1316
- *
1317
- * @example
1318
- * ```tsx
1319
- * function SiteHeader() {
1320
- * const site = useSiteConfig();
1321
- * return <header>{site.name}</header>;
1322
- * }
1323
- * ```
1324
- */
1325
- declare function useSiteConfig(): SiteConfig;
1326
- /**
1327
- * Gets the full render context.
1328
- *
1329
- * @returns The complete render context
1330
- * @throws Error if called outside of a render context
1331
- *
1332
- * @example
1333
- * ```tsx
1334
- * function Layout({ children }) {
1335
- * const ctx = useRenderContext();
1336
- * return (
1337
- * <html>
1338
- * <head><title>{ctx.page.title} - {ctx.site.name}</title></head>
1339
- * <body>{children}</body>
1340
- * </html>
1341
- * );
1342
- * }
1343
- * ```
1344
- */
1345
- declare function useRenderContext<T extends Record<string, unknown> = Record<string, unknown>>(): RenderContext<T>;
1346
- /**
1347
- * Gets the navigation groups.
1348
- *
1349
- * @example
1350
- * ```tsx
1351
- * function Sidebar() {
1352
- * const nav = useNav();
1353
- * return (
1354
- * <nav>
1355
- * {each(nav, (group) => (
1356
- * <div>
1357
- * <h3>{group.title}</h3>
1358
- * <ul>
1359
- * {each(group.items, (item) => (
1360
- * <li><a href={item.href}>{item.title}</a></li>
1361
- * ))}
1362
- * </ul>
1363
- * </div>
1364
- * ))}
1365
- * </nav>
1366
- * );
1367
- * }
1368
- * ```
1369
- */
1370
- declare function useNav(): NavGroup[];
1371
- /**
1372
- * Checks if the given path is the current page.
1373
- *
1374
- * @example
1375
- * ```tsx
1376
- * function NavLink({ href, children }) {
1377
- * const isActive = useIsActive(href);
1378
- * return <a href={href} class={isActive ? 'active' : ''}>{children}</a>;
1379
- * }
1380
- * ```
1381
- */
1382
- declare function useIsActive(path: string): boolean;
1383
- /**
1384
- * Schema for frontmatter type generation.
1385
- */
1386
- interface FrontmatterSchema {
1387
- /** Field name */
1388
- name: string;
1389
- /** TypeScript type */
1390
- type: string;
1391
- /** Whether the field is optional */
1392
- optional: boolean;
1393
- /** JSDoc description */
1394
- description?: string;
1395
- }
1396
- /**
1397
- * Infers TypeScript types from frontmatter values.
1398
- */
1399
- declare function inferType(value: unknown): string;
1400
- /**
1401
- * Generates TypeScript interface from frontmatter samples.
1402
- */
1403
- declare function generateFrontmatterTypes(samples: Record<string, unknown>[], interfaceName?: string): string;
1404
- //# sourceMappingURL=page-context.d.ts.map
1405
- //#endregion
1406
- //#region src/theme-renderer.d.ts
1407
- /**
1408
- * Theme component type.
1409
- */
1410
- type ThemeComponent = (props: ThemeProps) => JSXNode;
1411
- /**
1412
- * Props passed to the theme component.
1413
- */
1414
- interface ThemeProps {
1415
- /** Rendered page content as JSX */
1416
- children: JSXNode;
1417
- }
1418
- /**
1419
- * Page data for rendering.
1420
- */
1421
- interface PageData {
1422
- /** Page title */
1423
- title: string;
1424
- /** Page description */
1425
- description?: string;
1426
- /** Rendered HTML content */
1427
- html: string;
1428
- /** Table of contents */
1429
- toc: TocEntry[];
1430
- /** Source file path */
1431
- path: string;
1432
- /** Output URL path */
1433
- url: string;
1434
- /** Frontmatter */
1435
- frontmatter: Record<string, unknown>;
1436
- /** Layout name */
1437
- layout?: string;
1438
- }
1439
- /**
1440
- * Theme render options.
1441
- */
1442
- interface ThemeRenderOptions {
1443
- /** Theme component to use */
1444
- theme: ThemeComponent;
1445
- /** Site name */
1446
- siteName: string;
1447
- /** Base URL path */
1448
- base: string;
1449
- /** Navigation groups */
1450
- nav: NavGroup[];
1451
- /** All pages (for site context) */
1452
- pages: PageData[];
1453
- /** Output directory for type definitions */
1454
- typesOutDir?: string;
1455
- }
1456
- /**
1457
- * Renders a page using the theme component.
1458
- *
1459
- * @param page - Page data to render
1460
- * @param options - Theme render options
1461
- * @returns Rendered HTML string
1462
- */
1463
- declare function renderPage(page: PageData, options: ThemeRenderOptions): string;
1464
- /**
1465
- * Renders all pages and generates type definitions.
1466
- *
1467
- * @param pages - All pages to render
1468
- * @param options - Theme render options
1469
- * @returns Map of output paths to rendered HTML
1470
- */
1471
- declare function renderAllPages(pages: PageData[], options: ThemeRenderOptions): Promise<Map<string, string>>;
1472
- /**
1473
- * Generates TypeScript type definitions from page frontmatter.
1474
- *
1475
- * @param pages - All pages
1476
- * @param outDir - Output directory for types
1477
- */
1478
- declare function generateTypes(pages: PageData[], outDir: string): Promise<void>;
1479
- /**
1480
- * Default theme component.
1481
- * A minimal theme that renders page content with basic styling.
1482
- */
1483
- declare function DefaultTheme({
1484
- children
1485
- }: ThemeProps): JSXNode;
1486
- /**
1487
- * Creates a theme with layout switching support.
1488
- *
1489
- * @example
1490
- * ```tsx
1491
- * import { createTheme } from '@ox-content/vite-plugin';
1492
- * import { DefaultLayout } from './layouts/Default';
1493
- * import { EntryLayout } from './layouts/Entry';
1494
- *
1495
- * export default createTheme({
1496
- * layouts: {
1497
- * default: DefaultLayout,
1498
- * entry: EntryLayout,
1499
- * },
1500
- * });
1501
- * ```
1502
- */
1503
- declare function createTheme(config: {
1504
- layouts: Record<string, ThemeComponent>;
1505
- defaultLayout?: string;
1506
- }): ThemeComponent;
1507
- //# sourceMappingURL=theme-renderer.d.ts.map
1508
- //#endregion
1509
- //#region src/plugins/tabs.d.ts
1510
- /**
1511
- * Transform Tabs components in HTML.
1512
- */
1513
- declare function transformTabs(html: string): Promise<string>;
1514
- /**
1515
- * Generate dynamic CSS for :has() based tab switching.
1516
- * This is needed because :has() selectors need unique IDs.
1517
- */
1518
- declare function generateTabsCSS(groupCount: number): string;
1519
- //# sourceMappingURL=tabs.d.ts.map
1520
- //#endregion
1521
- //#region src/plugins/youtube.d.ts
1522
- /**
1523
- * YouTube Plugin - Privacy-enhanced iframe embedding
1524
- *
1525
- * Transforms <YouTube> components into responsive iframe embeds
1526
- * using youtube-nocookie.com for enhanced privacy.
1527
- */
1528
- interface YouTubeOptions {
1529
- /** Use privacy-enhanced mode (youtube-nocookie.com). Default: true */
1530
- privacyEnhanced?: boolean;
1531
- /** Default aspect ratio. Default: "16/9" */
1532
- aspectRatio?: string;
1533
- /** Allow fullscreen. Default: true */
1534
- allowFullscreen?: boolean;
1535
- /** Lazy load iframe. Default: true */
1536
- lazyLoad?: boolean;
1537
- }
1538
- /**
1539
- * Extract YouTube video ID from various URL formats.
1540
- */
1541
- declare function extractVideoId(input: string): string | null;
1542
- /**
1543
- * Transform YouTube components in HTML.
1544
- */
1545
- declare function transformYouTube(html: string, options?: YouTubeOptions): Promise<string>;
1546
- //# sourceMappingURL=youtube.d.ts.map
1547
- //#endregion
1548
- //#region src/plugins/github.d.ts
1549
- /**
1550
- * GitHub Plugin - Repository card embedding
1551
- *
1552
- * Transforms <GitHub> components into static repository cards
1553
- * by fetching data from GitHub API at build time.
1554
- */
1555
- interface GitHubRepoData {
1556
- name: string;
1557
- full_name: string;
1558
- description: string | null;
1559
- html_url: string;
1560
- stargazers_count: number;
1561
- forks_count: number;
1562
- language: string | null;
1563
- owner: {
1564
- login: string;
1565
- avatar_url: string;
1566
- };
1567
- }
1568
- interface GitHubOptions {
1569
- /** GitHub API token for higher rate limits. */
1570
- token?: string;
1571
- /** Cache fetched data. Default: true */
1572
- cache?: boolean;
1573
- /** Cache TTL in milliseconds. Default: 3600000 (1 hour) */
1574
- cacheTTL?: number;
1575
- }
1576
- /**
1577
- * Fetch repository data from GitHub API.
1578
- */
1579
- declare function fetchRepoData(repo: string, options: Required<GitHubOptions>): Promise<GitHubRepoData | null>;
1580
- /**
1581
- * Collect all GitHub repos from HTML for pre-fetching.
1582
- */
1583
- declare function collectGitHubRepos(html: string): Promise<string[]>;
1584
- /**
1585
- * Pre-fetch all GitHub repos data.
1586
- */
1587
- declare function prefetchGitHubRepos(repos: string[], options?: GitHubOptions): Promise<Map<string, GitHubRepoData | null>>;
1588
- /**
1589
- * Transform GitHub components in HTML.
1590
- */
1591
- declare function transformGitHub(html: string, repoDataMap?: Map<string, GitHubRepoData | null>, options?: GitHubOptions): Promise<string>;
1592
- //# sourceMappingURL=github.d.ts.map
1593
- //#endregion
1594
- //#region src/plugins/ogp.d.ts
1595
- /**
1596
- * OGP Card Plugin - Link card embedding
1597
- *
1598
- * Transforms <OgCard> components into static link preview cards
1599
- * by fetching OGP metadata at build time.
1600
- */
1601
- interface OgpData {
1602
- url: string;
1603
- title: string;
1604
- description?: string;
1605
- image?: string;
1606
- siteName?: string;
1607
- favicon?: string;
1608
- }
1609
- interface OgpOptions {
1610
- /** Request timeout in milliseconds. Default: 10000 */
1611
- timeout?: number;
1612
- /** Cache fetched data. Default: true */
1613
- cache?: boolean;
1614
- /** Cache TTL in milliseconds. Default: 3600000 (1 hour) */
1615
- cacheTTL?: number;
1616
- /** User agent for requests */
1617
- userAgent?: string;
1618
- }
1619
- /**
1620
- * Fetch OGP data for a URL.
1621
- */
1622
- declare function fetchOgpData(url: string, options: Required<OgpOptions>): Promise<OgpData | null>;
1623
- /**
1624
- * Collect all OGP URLs from HTML for pre-fetching.
1625
- */
1626
- declare function collectOgpUrls(html: string): Promise<string[]>;
1627
- /**
1628
- * Pre-fetch all OGP data.
1629
- */
1630
- declare function prefetchOgpData(urls: string[], options?: OgpOptions): Promise<Map<string, OgpData | null>>;
1631
- /**
1632
- * Transform OgCard components in HTML.
1633
- */
1634
- declare function transformOgp(html: string, ogpDataMap?: Map<string, OgpData | null>, options?: OgpOptions): Promise<string>;
1635
- //# sourceMappingURL=ogp.d.ts.map
1636
- //#endregion
1637
- //#region src/plugins/mermaid.d.ts
1638
- /**
1639
- * Mermaid Plugin - Native Rust renderer via NAPI
1640
- *
1641
- * Renders mermaid code blocks to SVG using the native Rust renderer
1642
- * via NAPI. Delegates to the NAPI `transformMermaid` function which
1643
- * extracts mermaid code blocks from HTML and renders them using mmdc.
1644
- */
1645
- interface MermaidOptions {
1646
- /** Mermaid theme. Default: "neutral" */
1647
- theme?: "default" | "dark" | "forest" | "neutral" | "base";
1648
- }
1649
- /**
1650
- * Transforms mermaid code blocks in HTML to rendered SVG diagrams.
1651
- * Uses the native Rust NAPI transformMermaid function.
1652
- */
1653
- declare function transformMermaidStatic(html: string, _options?: MermaidOptions): Promise<string>;
1654
- /**
1655
- * @deprecated No longer used. Mermaid rendering is now done at build time via NAPI.
1656
- */
1657
- declare const mermaidClientScript = "";
1658
- //# sourceMappingURL=mermaid.d.ts.map
1659
- //#endregion
1660
- //#region src/plugins/index.d.ts
1661
- /**
1662
- * Transform all plugin components in HTML.
1663
- * Call this during SSG build to process all plugins at once.
1664
- */
1665
- interface TransformAllOptions {
1666
- tabs?: boolean;
1667
- youtube?: boolean;
1668
- github?: boolean;
1669
- ogp?: boolean;
1670
- mermaid?: boolean;
1671
- githubToken?: string;
1672
- }
1673
- /**
1674
- * Transform all enabled plugins in HTML content.
1675
- */
1676
- declare function transformAllPlugins(html: string, options?: TransformAllOptions): Promise<string>;
1677
- //# sourceMappingURL=index.d.ts.map
1678
- //#endregion
1679
- //#region src/island/parse.d.ts
1680
- /**
1681
- * Island Parser
1682
- *
1683
- * Detects <Island> components in HTML and transforms them
1684
- * into hydration-ready elements with data attributes.
1685
- */
1686
- type LoadStrategy = "eager" | "idle" | "visible" | "media";
1687
- interface IslandInfo {
1688
- component: string;
1689
- load: LoadStrategy;
1690
- mediaQuery?: string;
1691
- props: Record<string, unknown>;
1692
- }
1693
- interface ParseIslandsResult {
1694
- html: string;
1695
- islands: IslandInfo[];
1696
- }
1697
- /**
1698
- * Reset island counter (for testing).
1699
- */
1700
-
1701
- /**
1702
- * Transform Island components in HTML.
1703
- *
1704
- * Converts:
1705
- * ```html
1706
- * <Island load="visible">
1707
- * <Counter initial={0} />
1708
- * </Island>
1709
- * ```
1710
- *
1711
- * To:
1712
- * ```html
1713
- * <div id="ox-island-0"
1714
- * data-ox-island="Counter"
1715
- * data-ox-load="visible"
1716
- * data-ox-props='{"initial":0}'
1717
- * class="ox-island">
1718
- * <!-- fallback content -->
1719
- * </div>
1720
- * ```
1721
- */
1722
- declare function transformIslands(html: string): Promise<ParseIslandsResult>;
1723
- /**
1724
- * Check if HTML contains any Island components.
1725
- */
1726
- declare function hasIslands(html: string): boolean;
1727
- /**
1728
- * Extract island info without transforming HTML.
1729
- * Useful for analysis/bundling purposes.
1730
- */
1731
- declare function extractIslandInfo(html: string): Promise<IslandInfo[]>;
1732
- /**
1733
- * Generate client-side hydration script.
1734
- * This is a minimal script that imports and initializes islands.
1735
- */
1736
- declare function generateHydrationScript(components: string[]): string;
1737
- //# sourceMappingURL=parse.d.ts.map
1738
- //#endregion
1739
- //#region src/og-image/types.d.ts
1740
- /**
1741
- * Type definitions for Chromium-based OG image generation.
1742
- */
1743
- /**
1744
- * Props passed to OG image template functions.
1745
- */
1746
- interface OgImageTemplateProps {
1747
- /** Page title */
1748
- title: string;
1749
- /** Page description */
1750
- description?: string;
1751
- /** Site name */
1752
- siteName?: string;
1753
- /** Author name */
1754
- author?: string;
1755
- /** Tags/categories */
1756
- tags?: string[];
1757
- /** Custom data from frontmatter (arbitrary key-value pairs) */
1758
- [key: string]: unknown;
1759
- }
1760
- /**
1761
- * Template function that receives page metadata and returns an HTML string.
1762
- */
1763
- type OgImageTemplateFn = (props: OgImageTemplateProps) => string | Promise<string>;
1764
- /**
1765
- * OG image generation options (user-facing).
1766
- */
1767
- interface OgImageOptions$1 {
1768
- /**
1769
- * Path to a custom template file (.ts, .vue, .svelte, .tsx/.jsx).
1770
- * - `.ts`: default-export a function `(props) => string`
1771
- * - `.vue`: Vue SFC, rendered via SSR
1772
- * - `.svelte`: Svelte SFC, rendered via SSR
1773
- * - `.tsx`/`.jsx`: React Server Component, rendered via SSR
1774
- * If not specified, the built-in default template is used.
1775
- */
1776
- template?: string;
1777
- /**
1778
- * Vue plugin to use for compiling `.vue` templates.
1779
- * - `'vitejs'`: Use `@vue/compiler-sfc` (official, default)
1780
- * - `'vizejs'`: Use `@vizejs/vite-plugin` (Rust-based)
1781
- * @default 'vitejs'
1782
- */
1783
- vuePlugin?: "vitejs" | "vizejs";
1784
- /**
1785
- * Image width in pixels.
1786
- * @default 1200
1787
- */
1788
- width?: number;
1789
- /**
1790
- * Image height in pixels.
1791
- * @default 630
1792
- */
1793
- height?: number;
1794
- /**
1795
- * Enable content-hash based caching.
1796
- * Skips rendering when content hasn't changed.
1797
- * @default true
1798
- */
1799
- cache?: boolean;
1800
- /**
1801
- * Number of concurrent page instances for parallel rendering.
1802
- * @default 1
1803
- */
1804
- concurrency?: number;
1805
- }
1806
- /**
1807
- * Resolved OG image options with all defaults applied.
1808
- */
1809
- interface ResolvedOgImageOptions {
1810
- template?: string;
1811
- vuePlugin: "vitejs" | "vizejs";
1812
- width: number;
1813
- height: number;
1814
- cache: boolean;
1815
- concurrency: number;
1816
- }
1817
- //# sourceMappingURL=types.d.ts.map
1818
- //#endregion
1819
- //#region src/og-image/browser.d.ts
1820
- /**
1821
- * Chromium browser session with automatic cleanup via Explicit Resource Management.
1822
- *
1823
- * Usage:
1824
- * await using session = await openBrowser();
1825
- * const png = await session.renderPage(html, 1200, 630);
1826
- * // browser.close() is called automatically when session goes out of scope
1827
- */
1828
- /**
1829
- * A browser session that can render HTML pages to PNG.
1830
- * Implements AsyncDisposable for automatic cleanup via `await using`.
1831
- */
1832
- interface OgBrowserSession extends AsyncDisposable {
1833
- renderPage(html: string, width: number, height: number, publicDir?: string): Promise<Buffer>;
1834
- }
1835
- /**
1836
- * Opens a Chromium browser and returns a session for rendering OG images.
1837
- * Returns null if Playwright/Chromium is not available.
1838
- *
1839
- * The session implements AsyncDisposable — use `await using` for automatic cleanup:
1840
- * ```ts
1841
- * await using session = await openBrowser();
1842
- * if (!session) return;
1843
- * const png = await session.renderPage(html, 1200, 630);
1844
- * ```
1845
- */
1846
- //#endregion
1847
- //#region src/og-image/index.d.ts
1848
- /**
1849
- * Resolves user-provided OG image options with defaults.
1850
- */
1851
- declare function resolveOgImageOptions(options: OgImageOptions$1 | undefined): ResolvedOgImageOptions;
1852
- /**
1853
- * A single page entry for batch OG image generation.
1854
- */
1855
- interface OgImagePageEntry {
1856
- /** Props to pass to the template */
1857
- props: OgImageTemplateProps;
1858
- /** Absolute path to write the output PNG */
1859
- outputPath: string;
1860
- }
1861
- /**
1862
- * Result of OG image generation for a single page.
1863
- */
1864
- interface OgImageResult {
1865
- outputPath: string;
1866
- cached: boolean;
1867
- error?: string;
1868
- }
1869
- /**
1870
- * Generates OG images for a batch of pages.
1871
- *
1872
- * Manages the full lifecycle: resolve template → launch browser (with `using`) →
1873
- * render each page (with caching and concurrency).
1874
- *
1875
- * All errors are non-fatal: failures are reported in results but never throw.
1876
- */
1877
- declare function generateOgImages(pages: OgImagePageEntry[], options: ResolvedOgImageOptions, root: string): Promise<OgImageResult[]>;
1878
- //# sourceMappingURL=index.d.ts.map
1879
- //#endregion
1880
- //#region src/i18n.d.ts
1881
- /**
1882
- * Resolves i18n options with defaults.
1883
- */
1884
- declare function resolveI18nOptions(options: I18nOptions | false | undefined): ResolvedI18nOptions | false;
1885
- /**
1886
- * Creates the i18n sub-plugin for the Vite plugin array.
1887
- */
1888
- declare function createI18nPlugin(resolvedOptions: ResolvedOptions): Plugin;
1889
- //# sourceMappingURL=i18n.d.ts.map
1890
-
1891
- //#endregion
1892
- //#region src/index.d.ts
1893
- /**
1894
- * Creates the Ox Content Vite plugin.
1895
- *
1896
- * @example
1897
- * ```ts
1898
- * // vite.config.ts
1899
- * import { defineConfig } from 'vite';
1900
- * import { oxContent } from '@ox-content/vite-plugin';
1901
- *
1902
- * export default defineConfig({
1903
- * plugins: [
1904
- * oxContent({
1905
- * srcDir: 'content',
1906
- * gfm: true,
1907
- * }),
1908
- * ],
1909
- * });
1910
- * ```
1911
- */
1912
- declare function oxContent(options?: OxContentOptions): Plugin[];
1913
- //#endregion
1914
- export { type BasePageProps, DEFAULT_HTML_TEMPLATE, DefaultTheme, type DocEntry, type DocsOptions, type EntryPageConfig, type ExtractedDocs, type FeatureConfig, Fragment, type FrontmatterSchema, type GitHubOptions, type GitHubRepoData, type HeroAction, type HeroConfig, type HeroImage, type I18nOptions, type IslandInfo, type JSXChild, type JSXElementType, type JSXNode, type JSXProps, type LanguageRegistration, type LoadStrategy, type LocaleConfig, MarkdownNode, MarkdownTransformer, type MermaidOptions, type NavGroup, type NavItem, type OgBrowserSession, type OgImageOptions, type OgImagePageEntry, type OgImageOptions$1 as OgImagePluginOptions, type OgImageResult, type OgImageTemplateFn, type OgImageTemplateProps, type OgpData, type OgpOptions, type OxContentOptions, type PageData, type PageProps, type ParamDoc, type ParseIslandsResult, type RenderContext, type ResolvedDocsOptions, type ResolvedI18nOptions, type ResolvedOgImageOptions, ResolvedOptions, type ResolvedSearchOptions, type ResolvedSsgOptions, type ResolvedThemeConfig, type ReturnDoc, type SearchDocument, type SearchOptions, type SearchResult, type SiteConfig, type SocialLinks, type SsgOptions, type ThemeColors, type ThemeComponent, type ThemeConfig, type ThemeEmbed, type ThemeFonts, type ThemeFooter, type ThemeHeader, type ThemeLayout, type ThemeProps, type ThemeRenderOptions, TocEntry, type TransformAllOptions, TransformContext, TransformResult, type YouTubeOptions, buildSearchIndex, buildSsg, clearRenderContext, collectGitHubRepos, collectOgpUrls, createI18nPlugin, createMarkdownEnvironment, createTheme, defaultTheme, defineTheme, each, extractDocs, extractIslandInfo, extractVideoId, fetchOgpData, fetchRepoData, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, hasIslands, inferType, jsx, jsxs, mergeThemes, mermaidClientScript, oxContent, prefetchGitHubRepos, prefetchOgpData, raw, renderAllPages, renderPage, renderToString, resolveDocsOptions, resolveI18nOptions, resolveOgImageOptions, resolveSearchOptions, resolveSsgOptions, resolveTheme, setRenderContext, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeSearchIndex };
1915
- //# sourceMappingURL=index.d.ts.map