@stacksjs/bunpress 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/toc.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ import type { TocConfig, TocData, TocHeading, TocPositionData } from './types';
2
+ /**
3
+ * Generate a URL-safe slug from heading text
4
+ */
5
+ export declare function generateSlug(text: string): string;
6
+ /**
7
+ * Generate unique slug for heading, handling duplicates
8
+ */
9
+ export declare function generateUniqueSlug(text: string, existingSlugs: Set<string>): string;
10
+ /**
11
+ * Extract headings from markdown content
12
+ */
13
+ export declare function extractHeadings(content: string): TocHeading[];
14
+ /**
15
+ * Build hierarchical TOC structure from flat headings
16
+ */
17
+ export declare function buildTocHierarchy(headings: TocHeading[]): TocHeading[];
18
+ /**
19
+ * Filter headings based on configuration
20
+ */
21
+ export declare function filterHeadings(headings: TocHeading[], config: TocConfig): TocHeading[];
22
+ /**
23
+ * Generate TOC HTML
24
+ */
25
+ export declare function generateTocHtml(data: TocData): string;
26
+ /**
27
+ * Generate inline TOC HTML (for [[toc]] syntax)
28
+ */
29
+ export declare function generateInlineTocHtml(data: TocData): string;
30
+ /**
31
+ * Generate sidebar TOC HTML
32
+ */
33
+ export declare function generateSidebarTocHtml(data: TocData): string;
34
+ /**
35
+ * Generate floating TOC HTML
36
+ */
37
+ export declare function generateFloatingTocHtml(data: TocData): string;
38
+ /**
39
+ * Generate TOC data from markdown content and configuration
40
+ */
41
+ export declare function generateTocData(content: string, config?: Partial<TocConfig>): TocData;
42
+ /**
43
+ * Generate TOC for specific positions
44
+ */
45
+ export declare function generateTocPositions(content: string, config?: Partial<TocConfig>): TocPositionData[];
46
+ /**
47
+ * Process [[toc]] inline syntax in markdown content
48
+ */
49
+ export declare function processInlineTocSyntax(content: string, tocData: TocData): string;
50
+ /**
51
+ * Generate heading anchors and enhance heading HTML
52
+ */
53
+ export declare function enhanceHeadingsWithAnchors(content: string): string;
54
+ /**
55
+ * Generate CSS for TOC styling and interactions
56
+ */
57
+ export declare function generateTocStyles(): string;
58
+ /**
59
+ * Generate JavaScript for TOC interactions
60
+ */
61
+ export declare function generateTocScripts(): string;
62
+ /**
63
+ * Default TOC configuration
64
+ */
65
+ export declare const defaultTocConfig: Required<TocConfig>;
@@ -0,0 +1,241 @@
1
+ import type { marked } from 'marked';
2
+ export declare interface BunPressConfig {
3
+ verbose: boolean
4
+ markdown: MarkdownPluginConfig
5
+ nav?: NavItem[]
6
+ plugins?: ConfigPlugin[]
7
+ sitemap?: SitemapConfig
8
+ robots?: RobotsConfig
9
+ }
10
+ /**
11
+ * Configuration options for the markdown plugin
12
+ */
13
+ export declare interface MarkdownPluginConfig {
14
+ template?: string
15
+ css?: string
16
+ scripts?: string[]
17
+ title?: string
18
+ meta?: Record<string, string>
19
+ markedOptions?: Parameters<typeof marked.parse>[1]
20
+ preserveDirectoryStructure?: boolean
21
+ toc?: TocConfig
22
+ sidebar?: Record<string, SidebarItem[]>
23
+ nav?: NavItem[]
24
+ search?: SearchConfig
25
+ themeConfig?: ThemeConfig
26
+ sitemap?: SitemapConfig
27
+ robots?: RobotsConfig
28
+ }
29
+ /**
30
+ * Sidebar navigation item
31
+ */
32
+ export declare interface SidebarItem {
33
+ text: string
34
+ link?: string
35
+ items?: SidebarItem[]
36
+ }
37
+ /**
38
+ * Navigation bar item
39
+ */
40
+ export declare interface NavItem {
41
+ text: string
42
+ link?: string
43
+ icon?: string
44
+ items?: NavItem[]
45
+ activeMatch?: string
46
+ }
47
+ /**
48
+ * Action link in hero section
49
+ */
50
+ export declare interface HeroAction {
51
+ theme?: 'brand' | 'alt'
52
+ text: string
53
+ link: string
54
+ }
55
+ /**
56
+ * Hero section configuration
57
+ */
58
+ export declare interface Hero {
59
+ name?: string
60
+ text: string
61
+ tagline?: string
62
+ image?: string
63
+ actions?: HeroAction[]
64
+ }
65
+ /**
66
+ * Feature item configuration
67
+ */
68
+ export declare interface Feature {
69
+ title: string
70
+ icon?: string
71
+ details: string
72
+ }
73
+ /**
74
+ * Frontmatter structure extracted from markdown files
75
+ */
76
+ export declare interface Frontmatter {
77
+ title?: string
78
+ layout?: 'home' | 'doc' | 'page'
79
+ hero?: Hero
80
+ features?: Feature[]
81
+ }
82
+ /**
83
+ * Table of Contents configuration
84
+ */
85
+ export declare interface TocConfig {
86
+ enabled?: boolean
87
+ position?: TocPosition | TocPosition[]
88
+ title?: string
89
+ maxDepth?: number
90
+ minDepth?: number
91
+ className?: string
92
+ smoothScroll?: boolean
93
+ activeHighlight?: boolean
94
+ collapsible?: boolean
95
+ exclude?: string[]
96
+ }
97
+ /**
98
+ * Search configuration
99
+ */
100
+ export declare interface SearchConfig {
101
+ enabled?: boolean
102
+ placeholder?: string
103
+ maxResults?: number
104
+ keyboardShortcuts?: boolean
105
+ searchFn?: (query: string, content: string[]) => SearchResult[]
106
+ }
107
+ /**
108
+ * Search result item
109
+ */
110
+ export declare interface SearchResult {
111
+ title: string
112
+ url: string
113
+ content: string
114
+ score: number
115
+ }
116
+ /**
117
+ * Theme configuration
118
+ */
119
+ export declare interface ThemeConfig {
120
+ colors?: {
121
+ primary?: string
122
+ secondary?: string
123
+ accent?: string
124
+ background?: string
125
+ surface?: string
126
+ text?: string
127
+ muted?: string
128
+ }
129
+ fonts?: {
130
+ heading?: string
131
+ body?: string
132
+ mono?: string
133
+ }
134
+ darkMode?: boolean | 'auto'
135
+ cssVars?: Record<string, string>
136
+ css?: string
137
+ }
138
+ /**
139
+ * Configuration plugin interface
140
+ */
141
+ export declare interface ConfigPlugin {
142
+ name: string
143
+ extendConfig?: (config: BunPressConfig) => BunPressConfig
144
+ validateConfig?: (config: BunPressConfig) => ConfigValidationResult
145
+ onConfigLoad?: (config: BunPressConfig) => void | Promise<void>
146
+ onConfigChange?: (newConfig: BunPressConfig, oldConfig: BunPressConfig) => void | Promise<void>
147
+ }
148
+ /**
149
+ * Configuration validation result
150
+ */
151
+ export declare interface ConfigValidationResult {
152
+ valid: boolean
153
+ errors: string[]
154
+ warnings: string[]
155
+ }
156
+ /**
157
+ * Heading item in TOC
158
+ */
159
+ export declare interface TocHeading {
160
+ level: number
161
+ text: string
162
+ id: string
163
+ children: TocHeading[]
164
+ exclude?: boolean
165
+ hasCode?: boolean
166
+ }
167
+ /**
168
+ * Table of Contents data structure
169
+ */
170
+ export declare interface TocData {
171
+ title: string
172
+ items: TocHeading[]
173
+ config: TocConfig
174
+ }
175
+ /**
176
+ * TOC position data
177
+ */
178
+ export declare interface TocPositionData {
179
+ position: TocPosition
180
+ data: TocData
181
+ html: string
182
+ }
183
+ /**
184
+ * Sitemap configuration
185
+ */
186
+ export declare interface SitemapConfig {
187
+ enabled?: boolean
188
+ baseUrl?: string
189
+ filename?: string
190
+ defaultPriority?: number
191
+ defaultChangefreq?: SitemapChangefreq
192
+ priorityMap?: Record<string, number>
193
+ changefreqMap?: Record<string, SitemapChangefreq>
194
+ exclude?: string[]
195
+ maxUrlsPerFile?: number
196
+ useSitemapIndex?: boolean
197
+ transform?: (entry: SitemapEntry) => SitemapEntry | null
198
+ verbose?: boolean
199
+ }
200
+ /**
201
+ * Sitemap entry
202
+ */
203
+ export declare interface SitemapEntry {
204
+ url: string
205
+ lastmod?: string | Date
206
+ changefreq?: SitemapChangefreq
207
+ priority?: number
208
+ }
209
+ /**
210
+ * Robots.txt configuration
211
+ */
212
+ export declare interface RobotsConfig {
213
+ enabled?: boolean
214
+ filename?: string
215
+ rules?: RobotsRule[]
216
+ sitemaps?: string[]
217
+ host?: string
218
+ customContent?: string
219
+ }
220
+ /**
221
+ * Robots.txt rule
222
+ */
223
+ export declare interface RobotsRule {
224
+ userAgent: string
225
+ allow?: string[]
226
+ disallow?: string[]
227
+ crawlDelay?: number
228
+ }
229
+ export type BunPressOptions = Partial<BunPressConfig>
230
+ /**
231
+ * Plugin options for the Markdown plugin
232
+ */
233
+ export type MarkdownPluginOptions = Partial<MarkdownPluginConfig>
234
+ /**
235
+ * TOC position options
236
+ */
237
+ export type TocPosition = 'sidebar' | 'inline' | 'floating'
238
+ /**
239
+ * Sitemap change frequency values
240
+ */
241
+ export type SitemapChangefreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@stacksjs/bunpress",
3
+ "type": "module",
4
+ "version": "0.0.5",
5
+ "description": "Modern documentation engine. Powered by Bun.",
6
+ "author": "Chris Breuer <chris@stacksjs.org>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/stacksjs/bunpress#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/stacksjs/bunpress.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/stacksjs/bunpress/issues"
15
+ },
16
+ "keywords": [
17
+ "bunpress",
18
+ "bun",
19
+ "cli",
20
+ "typescript",
21
+ "vitepress alternative"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/src/index.js"
27
+ },
28
+ "./*": {
29
+ "import": "./dist/*"
30
+ }
31
+ },
32
+ "module": "./dist/src/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "bin": {
35
+ "bunpress": "./dist/bin/cli.js"
36
+ },
37
+ "files": [
38
+ "README.md",
39
+ "dist"
40
+ ],
41
+ "scripts": {
42
+ "dev": "bun run dev:docs",
43
+ "build": "bun --bun build.ts && bun run compile",
44
+ "compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/bunpress",
45
+ "compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
46
+ "compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/bunpress-linux-x64",
47
+ "compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/bunpress-linux-arm64",
48
+ "compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/bunpress-windows-x64.exe",
49
+ "compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/bunpress-darwin-x64",
50
+ "compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/bunpress-darwin-arm64",
51
+ "fresh": "bunx rimraf node_modules/ bun.lock && bun i",
52
+ "prepublishOnly": "bun --bun run build && bun run compile:all",
53
+ "test": "bun test --reporter=verbose",
54
+ "test:quick": "bun test --timeout=10000",
55
+ "test:full": "bun test --timeout=60000 --no-bail",
56
+ "lint": "bunx --bun eslint .",
57
+ "lint:fix": "bunx --bun eslint . --fix",
58
+ "changelog": "bunx logsmith --verbose",
59
+ "changelog:generate": "bunx logsmith --output CHANGELOG.md",
60
+ "release": "bun run changelog:generate && bunx --bun bumpx prompt --recursive",
61
+ "dev:docs": "bun bin/cli.ts dev",
62
+ "build:docs": "bun build.ts",
63
+ "preview:docs": "bun serve --port 3000 dist",
64
+ "typecheck": "bun --bun tsc --noEmit"
65
+ },
66
+ "devDependencies": {
67
+ "@stacksjs/bumpx": "^0.1.84",
68
+ "@stacksjs/eslint-config": "^4.14.0-beta.3",
69
+ "@stacksjs/gitlint": "^0.1.5",
70
+ "@stacksjs/headwind": "^0.1.1",
71
+ "@stacksjs/logsmith": "^0.1.18",
72
+ "@stacksjs/ts-i18n": "^0.0.0",
73
+ "bun-git-hooks": "^0.3.1",
74
+ "bun-plugin-dtsx": "0.9.5",
75
+ "bunfig": "^0.15.0",
76
+ "typescript": "^5.9.3"
77
+ },
78
+ "git-hooks": {
79
+ "pre-commit": {
80
+ "staged-lint": {
81
+ "*.{js,ts,json,yaml,yml,md}": "bunx --bun eslint --fix"
82
+ }
83
+ },
84
+ "commit-msg": "bunx gitlint --edit .git/COMMIT_EDITMSG"
85
+ }
86
+ }