specra 0.1.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.
- package/LICENSE.MD +21 -0
- package/README.md +157 -0
- package/dist/app/api/mdx-watch/route.d.mts +12 -0
- package/dist/app/api/mdx-watch/route.d.ts +12 -0
- package/dist/app/api/mdx-watch/route.js +98 -0
- package/dist/app/api/mdx-watch/route.js.map +1 -0
- package/dist/app/api/mdx-watch/route.mjs +71 -0
- package/dist/app/api/mdx-watch/route.mjs.map +1 -0
- package/dist/app/docs-page.d.mts +32 -0
- package/dist/app/docs-page.d.ts +32 -0
- package/dist/app/docs-page.js +4072 -0
- package/dist/app/docs-page.js.map +1 -0
- package/dist/app/docs-page.mjs +14 -0
- package/dist/app/docs-page.mjs.map +1 -0
- package/dist/app/layout.css +297 -0
- package/dist/app/layout.css.map +1 -0
- package/dist/app/layout.d.mts +19 -0
- package/dist/app/layout.d.ts +19 -0
- package/dist/app/layout.js +112 -0
- package/dist/app/layout.js.map +1 -0
- package/dist/app/layout.mjs +13 -0
- package/dist/app/layout.mjs.map +1 -0
- package/dist/chunk-DR4EPLMT.mjs +1013 -0
- package/dist/chunk-DR4EPLMT.mjs.map +1 -0
- package/dist/chunk-INL2EC72.mjs +170 -0
- package/dist/chunk-INL2EC72.mjs.map +1 -0
- package/dist/chunk-IZFGEAD6.mjs +61 -0
- package/dist/chunk-IZFGEAD6.mjs.map +1 -0
- package/dist/chunk-KTRWWAGL.mjs +50 -0
- package/dist/chunk-KTRWWAGL.mjs.map +1 -0
- package/dist/chunk-MZJHJ6BV.mjs +21 -0
- package/dist/chunk-MZJHJ6BV.mjs.map +1 -0
- package/dist/chunk-NXRIAL7T.mjs +3119 -0
- package/dist/chunk-NXRIAL7T.mjs.map +1 -0
- package/dist/components/index.d.mts +822 -0
- package/dist/components/index.d.ts +822 -0
- package/dist/components/index.js +3738 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +3627 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/index.css +297 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +545 -0
- package/dist/index.d.ts +545 -0
- package/dist/index.js +4648 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +347 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/index.d.mts +798 -0
- package/dist/lib/index.d.ts +798 -0
- package/dist/lib/index.js +1301 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +89 -0
- package/dist/lib/index.mjs.map +1 -0
- package/package.json +119 -0
- package/src/app/api/mdx-watch/route.ts +86 -0
- package/src/app/docs-page.tsx +212 -0
- package/src/app/layout.tsx +74 -0
- package/src/components/docs/accordion.tsx +53 -0
- package/src/components/docs/api/api-endpoint.tsx +59 -0
- package/src/components/docs/api/api-params.tsx +43 -0
- package/src/components/docs/api/api-playground.tsx +233 -0
- package/src/components/docs/api/api-reference.tsx +291 -0
- package/src/components/docs/api/api-response.tsx +48 -0
- package/src/components/docs/api/index.ts +5 -0
- package/src/components/docs/badge.tsx +22 -0
- package/src/components/docs/breadcrumb.tsx +51 -0
- package/src/components/docs/callout.tsx +109 -0
- package/src/components/docs/card.tsx +84 -0
- package/src/components/docs/category-index.tsx +112 -0
- package/src/components/docs/code-block.tsx +129 -0
- package/src/components/docs/columns.tsx +45 -0
- package/src/components/docs/componentTextProps.ts +85 -0
- package/src/components/docs/dev-mode-badge.tsx +35 -0
- package/src/components/docs/doc-layout-wrapper.tsx +54 -0
- package/src/components/docs/doc-layout.tsx +111 -0
- package/src/components/docs/doc-loading.tsx +15 -0
- package/src/components/docs/doc-metadata.tsx +55 -0
- package/src/components/docs/doc-navigation.tsx +62 -0
- package/src/components/docs/doc-tags.tsx +25 -0
- package/src/components/docs/draft-badge.tsx +10 -0
- package/src/components/docs/footer.tsx +47 -0
- package/src/components/docs/frame.tsx +22 -0
- package/src/components/docs/header.tsx +122 -0
- package/src/components/docs/hot-reload-indicator.tsx +77 -0
- package/src/components/docs/icon.tsx +70 -0
- package/src/components/docs/image-card.tsx +95 -0
- package/src/components/docs/image.tsx +73 -0
- package/src/components/docs/index.ts +48 -0
- package/src/components/docs/math.tsx +46 -0
- package/src/components/docs/mdx-components.tsx +166 -0
- package/src/components/docs/mdx-hot-reload.tsx +37 -0
- package/src/components/docs/mermaid.tsx +77 -0
- package/src/components/docs/mobile-doc-layout.tsx +115 -0
- package/src/components/docs/not-found-content.tsx +55 -0
- package/src/components/docs/search-highlight.tsx +127 -0
- package/src/components/docs/search-modal.tsx +223 -0
- package/src/components/docs/sidebar-skeleton.tsx +39 -0
- package/src/components/docs/sidebar.tsx +323 -0
- package/src/components/docs/site-banner.tsx +92 -0
- package/src/components/docs/steps.tsx +29 -0
- package/src/components/docs/tab-context.tsx +28 -0
- package/src/components/docs/tab-groups.tsx +50 -0
- package/src/components/docs/table-of-contents.tsx +104 -0
- package/src/components/docs/tabs.tsx +63 -0
- package/src/components/docs/theme-toggle.tsx +39 -0
- package/src/components/docs/tooltip.tsx +37 -0
- package/src/components/docs/version-switcher.tsx +52 -0
- package/src/components/docs/video.tsx +80 -0
- package/src/components/global/index.ts +3 -0
- package/src/components/global/version-not-found.tsx +26 -0
- package/src/components/index.ts +8 -0
- package/src/components/theme-provider.tsx +11 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/index.ts +6 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/index.ts +41 -0
- package/src/lib/api-parser.types.ts +78 -0
- package/src/lib/api.types.ts +202 -0
- package/src/lib/category.ts +71 -0
- package/src/lib/config.server.ts +170 -0
- package/src/lib/config.ts +20 -0
- package/src/lib/config.types.ts +295 -0
- package/src/lib/dev-utils.ts +75 -0
- package/src/lib/index.ts +27 -0
- package/src/lib/mdx-cache.ts +200 -0
- package/src/lib/mdx.ts +402 -0
- package/src/lib/parsers/base-parser.ts +16 -0
- package/src/lib/parsers/index.ts +69 -0
- package/src/lib/parsers/openapi-parser.ts +251 -0
- package/src/lib/parsers/postman-parser.ts +301 -0
- package/src/lib/parsers/specra-parser.ts +24 -0
- package/src/lib/redirects.ts +40 -0
- package/src/lib/remark-code-meta.ts +23 -0
- package/src/lib/sidebar-utils.ts +188 -0
- package/src/lib/toc.ts +24 -0
- package/src/lib/utils.ts +36 -0
- package/src/specra.config.json +124 -0
- package/src/styles/globals.css +427 -0
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
interface DocMeta {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
slug?: string;
|
|
7
|
+
section?: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
sidebar?: string;
|
|
10
|
+
order?: number;
|
|
11
|
+
sidebar_position?: number;
|
|
12
|
+
content?: string;
|
|
13
|
+
last_updated?: string;
|
|
14
|
+
draft?: boolean;
|
|
15
|
+
authors?: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
}>;
|
|
19
|
+
tags?: string[];
|
|
20
|
+
redirect_from?: string[];
|
|
21
|
+
reading_time?: number;
|
|
22
|
+
word_count?: number;
|
|
23
|
+
icon?: string;
|
|
24
|
+
tab_group?: string;
|
|
25
|
+
}
|
|
26
|
+
interface Doc {
|
|
27
|
+
slug: string;
|
|
28
|
+
filePath: string;
|
|
29
|
+
title: string;
|
|
30
|
+
meta: DocMeta;
|
|
31
|
+
content: string;
|
|
32
|
+
categoryLabel?: string;
|
|
33
|
+
categoryPosition?: number;
|
|
34
|
+
categoryCollapsible?: boolean;
|
|
35
|
+
categoryCollapsed?: boolean;
|
|
36
|
+
categoryIcon?: string;
|
|
37
|
+
categoryTabGroup?: string;
|
|
38
|
+
}
|
|
39
|
+
interface TocItem {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
level: number;
|
|
43
|
+
}
|
|
44
|
+
declare function getVersions(): string[];
|
|
45
|
+
declare function getDocBySlug(slug: string, version?: string): Promise<Doc | null>;
|
|
46
|
+
declare function getAllDocs(version?: string): Promise<Doc[]>;
|
|
47
|
+
declare function getAdjacentDocs(currentSlug: string, allDocs: Doc[]): {
|
|
48
|
+
previous?: Doc;
|
|
49
|
+
next?: Doc;
|
|
50
|
+
};
|
|
51
|
+
declare function extractTableOfContents(content: string): TocItem[];
|
|
52
|
+
/**
|
|
53
|
+
* Check if a slug represents a category (has child documents)
|
|
54
|
+
*/
|
|
55
|
+
declare function isCategoryPage(slug: string, allDocs: Doc[]): boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Caching layer for MDX operations to improve development performance
|
|
59
|
+
*
|
|
60
|
+
* This module provides in-memory caching for expensive file system operations
|
|
61
|
+
* that occur during static generation. In development mode, caches are
|
|
62
|
+
* invalidated automatically when files change.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Cached version of getVersions()
|
|
67
|
+
*/
|
|
68
|
+
declare function getCachedVersions(): string[];
|
|
69
|
+
/**
|
|
70
|
+
* Cached version of getAllDocs()
|
|
71
|
+
*/
|
|
72
|
+
declare function getCachedAllDocs(version?: string): Promise<Doc[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Cached version of getDocBySlug()
|
|
75
|
+
*/
|
|
76
|
+
declare function getCachedDocBySlug(slug: string, version?: string): Promise<Doc | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Manually clear all caches
|
|
79
|
+
* Useful for testing or when you want to force a refresh
|
|
80
|
+
*/
|
|
81
|
+
declare function clearAllCaches(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get cache statistics for debugging
|
|
84
|
+
*/
|
|
85
|
+
declare function getCacheStats(): {
|
|
86
|
+
versions: {
|
|
87
|
+
cached: boolean;
|
|
88
|
+
age: number;
|
|
89
|
+
};
|
|
90
|
+
allDocs: {
|
|
91
|
+
entries: number;
|
|
92
|
+
versions: string[];
|
|
93
|
+
};
|
|
94
|
+
docBySlug: {
|
|
95
|
+
entries: number;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
interface TOCItem {
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
level: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Extract headings from HTML string for table of contents
|
|
106
|
+
*/
|
|
107
|
+
declare function extractHeadings(html: string): TOCItem[];
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Configuration schema for Specra documentation system
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* Site metadata and branding
|
|
114
|
+
*/
|
|
115
|
+
interface SiteConfig {
|
|
116
|
+
/** The title of the documentation site */
|
|
117
|
+
title: string;
|
|
118
|
+
/** Short description of the documentation */
|
|
119
|
+
description?: string;
|
|
120
|
+
/** URL where the documentation is hosted */
|
|
121
|
+
url?: string;
|
|
122
|
+
/** Base URL path for the documentation (e.g., '/docs') */
|
|
123
|
+
baseUrl?: string;
|
|
124
|
+
/** Path to the site logo */
|
|
125
|
+
logo?: string;
|
|
126
|
+
/** Path to the favicon */
|
|
127
|
+
favicon?: string;
|
|
128
|
+
/** Default language for the documentation */
|
|
129
|
+
language?: string;
|
|
130
|
+
/** Organization or author name */
|
|
131
|
+
organizationName?: string;
|
|
132
|
+
/** Project name */
|
|
133
|
+
projectName?: string;
|
|
134
|
+
/** Active/default version for the documentation */
|
|
135
|
+
activeVersion?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Theme and appearance settings
|
|
139
|
+
*/
|
|
140
|
+
interface ThemeConfig {
|
|
141
|
+
/** Primary color for the theme */
|
|
142
|
+
primaryColor?: string;
|
|
143
|
+
/** Default theme mode */
|
|
144
|
+
defaultMode?: "light" | "dark" | "system";
|
|
145
|
+
/** Whether to respect system preferences */
|
|
146
|
+
respectPrefersColorScheme?: boolean;
|
|
147
|
+
/** Custom CSS file path */
|
|
148
|
+
customCss?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Tab group for organizing documentation
|
|
152
|
+
*/
|
|
153
|
+
interface TabGroup {
|
|
154
|
+
/** Unique identifier for the tab group */
|
|
155
|
+
id: string;
|
|
156
|
+
/** Display label for the tab */
|
|
157
|
+
label: string;
|
|
158
|
+
/** Optional icon name (lucide-react icon) */
|
|
159
|
+
icon?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Navigation and sidebar configuration
|
|
163
|
+
*/
|
|
164
|
+
interface NavigationConfig {
|
|
165
|
+
/** Whether to show the sidebar by default */
|
|
166
|
+
showSidebar?: boolean;
|
|
167
|
+
/** Whether the sidebar is collapsible */
|
|
168
|
+
collapsibleSidebar?: boolean;
|
|
169
|
+
/** Whether to show breadcrumbs */
|
|
170
|
+
showBreadcrumbs?: boolean;
|
|
171
|
+
/** Whether to show table of contents */
|
|
172
|
+
showTableOfContents?: boolean;
|
|
173
|
+
/** Position of table of contents */
|
|
174
|
+
tocPosition?: "left" | "right";
|
|
175
|
+
/** Maximum depth for table of contents */
|
|
176
|
+
tocMaxDepth?: number;
|
|
177
|
+
/** Tab groups for organizing documentation sections */
|
|
178
|
+
tabGroups?: TabGroup[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Social and external links
|
|
182
|
+
*/
|
|
183
|
+
interface SocialLinks {
|
|
184
|
+
/** GitHub repository URL */
|
|
185
|
+
github?: string;
|
|
186
|
+
/** Twitter/X handle or URL */
|
|
187
|
+
twitter?: string;
|
|
188
|
+
/** Discord invite URL */
|
|
189
|
+
discord?: string;
|
|
190
|
+
/** LinkedIn profile or company page */
|
|
191
|
+
linkedin?: string;
|
|
192
|
+
/** YouTube channel URL */
|
|
193
|
+
youtube?: string;
|
|
194
|
+
/** Custom social links */
|
|
195
|
+
custom?: Array<{
|
|
196
|
+
label: string;
|
|
197
|
+
url: string;
|
|
198
|
+
icon?: string;
|
|
199
|
+
}>;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Search configuration
|
|
203
|
+
*/
|
|
204
|
+
interface SearchConfig {
|
|
205
|
+
/** Enable/disable search functionality */
|
|
206
|
+
enabled?: boolean;
|
|
207
|
+
/** Placeholder text for search input */
|
|
208
|
+
placeholder?: string;
|
|
209
|
+
/** Search provider type */
|
|
210
|
+
provider?: "meilisearch" | "algolia" | "local";
|
|
211
|
+
/** Meilisearch configuration */
|
|
212
|
+
meilisearch?: {
|
|
213
|
+
/** Meilisearch server URL */
|
|
214
|
+
host: string;
|
|
215
|
+
/** API key for Meilisearch */
|
|
216
|
+
apiKey?: string;
|
|
217
|
+
/** Index name */
|
|
218
|
+
indexName: string;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Analytics configuration
|
|
223
|
+
*/
|
|
224
|
+
interface AnalyticsConfig {
|
|
225
|
+
/** Google Analytics tracking ID */
|
|
226
|
+
googleAnalytics?: string;
|
|
227
|
+
/** Google Tag Manager ID */
|
|
228
|
+
googleTagManager?: string;
|
|
229
|
+
/** Plausible Analytics domain */
|
|
230
|
+
plausible?: string;
|
|
231
|
+
/** Custom analytics scripts */
|
|
232
|
+
custom?: Array<{
|
|
233
|
+
src: string;
|
|
234
|
+
async?: boolean;
|
|
235
|
+
defer?: boolean;
|
|
236
|
+
}>;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Footer configuration
|
|
240
|
+
*/
|
|
241
|
+
interface FooterConfig {
|
|
242
|
+
/** Copyright text */
|
|
243
|
+
copyright?: string;
|
|
244
|
+
/** Footer links organized by columns */
|
|
245
|
+
links?: Array<{
|
|
246
|
+
title: string;
|
|
247
|
+
items: Array<{
|
|
248
|
+
label: string;
|
|
249
|
+
href: string;
|
|
250
|
+
}>;
|
|
251
|
+
}>;
|
|
252
|
+
/** Custom footer content */
|
|
253
|
+
customContent?: string;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Documentation features
|
|
257
|
+
*/
|
|
258
|
+
interface FeaturesConfig {
|
|
259
|
+
/** Enable/disable edit this page links */
|
|
260
|
+
editUrl?: string | false;
|
|
261
|
+
/** Show last updated timestamp */
|
|
262
|
+
showLastUpdated?: boolean;
|
|
263
|
+
/** Show reading time estimate */
|
|
264
|
+
showReadingTime?: boolean;
|
|
265
|
+
/** Show author information */
|
|
266
|
+
showAuthors?: boolean;
|
|
267
|
+
/** Show tags */
|
|
268
|
+
showTags?: boolean;
|
|
269
|
+
/** Enable version dropdown */
|
|
270
|
+
versioning?: boolean;
|
|
271
|
+
/** Enable i18n (internationalization) */
|
|
272
|
+
i18n?: boolean;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Site-wide banner configuration
|
|
276
|
+
*/
|
|
277
|
+
interface BannerConfig {
|
|
278
|
+
/** Whether the banner is enabled */
|
|
279
|
+
enabled?: boolean;
|
|
280
|
+
/** Banner message */
|
|
281
|
+
message?: string;
|
|
282
|
+
/** Banner type */
|
|
283
|
+
type?: "info" | "warning" | "success" | "error";
|
|
284
|
+
/** Whether the banner can be dismissed */
|
|
285
|
+
dismissible?: boolean;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Environment variables that can be used in documentation
|
|
289
|
+
* These will be replaced at build time or runtime
|
|
290
|
+
*/
|
|
291
|
+
interface EnvironmentVariables {
|
|
292
|
+
/** API base URL */
|
|
293
|
+
API_BASE_URL?: string;
|
|
294
|
+
/** API version */
|
|
295
|
+
API_VERSION?: string;
|
|
296
|
+
/** CDN URL */
|
|
297
|
+
CDN_URL?: string;
|
|
298
|
+
/** Custom environment variables */
|
|
299
|
+
[key: string]: string | undefined;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Deployment configuration for different hosting scenarios
|
|
303
|
+
*/
|
|
304
|
+
interface DeploymentConfig {
|
|
305
|
+
/**
|
|
306
|
+
* Deployment target
|
|
307
|
+
* - 'vercel': For Vercel or similar Node.js hosting (uses 'standalone' output)
|
|
308
|
+
* - 'github-pages': For GitHub Pages static hosting (uses 'export' output)
|
|
309
|
+
* - 'static': For any static hosting like Netlify, Cloudflare Pages, etc.
|
|
310
|
+
* - 'custom-domain-static': For static hosting with custom domain (no basePath needed)
|
|
311
|
+
*/
|
|
312
|
+
target?: "vercel" | "github-pages" | "static" | "custom-domain-static";
|
|
313
|
+
/**
|
|
314
|
+
* Base path for assets when deploying to GitHub Pages without custom domain
|
|
315
|
+
* This should be your repository name (e.g., 'my-repo')
|
|
316
|
+
* Only used when target is 'github-pages' and no custom domain is configured
|
|
317
|
+
*/
|
|
318
|
+
basePath?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Whether a custom domain is configured
|
|
321
|
+
* When true, basePath will be ignored even for GitHub Pages
|
|
322
|
+
*/
|
|
323
|
+
customDomain?: boolean;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Main configuration interface
|
|
327
|
+
*/
|
|
328
|
+
interface SpecraConfig {
|
|
329
|
+
/** Site metadata and branding */
|
|
330
|
+
site: SiteConfig;
|
|
331
|
+
/** Theme and appearance settings */
|
|
332
|
+
theme?: ThemeConfig;
|
|
333
|
+
/** Navigation and sidebar configuration */
|
|
334
|
+
navigation?: NavigationConfig;
|
|
335
|
+
/** Social and external links */
|
|
336
|
+
social?: SocialLinks;
|
|
337
|
+
/** Search configuration */
|
|
338
|
+
search?: SearchConfig;
|
|
339
|
+
/** Analytics configuration */
|
|
340
|
+
analytics?: AnalyticsConfig;
|
|
341
|
+
/** Footer configuration */
|
|
342
|
+
footer?: FooterConfig;
|
|
343
|
+
/** Site-wide banner */
|
|
344
|
+
banner?: BannerConfig;
|
|
345
|
+
/** Documentation features */
|
|
346
|
+
features?: FeaturesConfig;
|
|
347
|
+
/** Environment variables for use in docs */
|
|
348
|
+
env?: EnvironmentVariables;
|
|
349
|
+
/** Deployment configuration */
|
|
350
|
+
deployment?: DeploymentConfig;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Default configuration values
|
|
354
|
+
*/
|
|
355
|
+
declare const defaultConfig: SpecraConfig;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Load and parse the Specra configuration file
|
|
359
|
+
* Falls back to default configuration if file doesn't exist or is invalid
|
|
360
|
+
*/
|
|
361
|
+
declare function loadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
|
|
362
|
+
/**
|
|
363
|
+
* Get a specific configuration value by path (SERVER ONLY)
|
|
364
|
+
* Example: getConfigValue('site.title') or getConfigValue('theme.defaultMode')
|
|
365
|
+
*/
|
|
366
|
+
declare function getConfigValue<T = any>(path: string, config?: SpecraConfig): T | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* Replace environment variables in a string (SERVER ONLY)
|
|
369
|
+
* Supports ${ENV_VAR} and {{ENV_VAR}} syntax
|
|
370
|
+
*/
|
|
371
|
+
declare function replaceEnvVariables(text: string, config?: SpecraConfig): string;
|
|
372
|
+
/**
|
|
373
|
+
* Process content and replace all environment variables (SERVER ONLY)
|
|
374
|
+
*/
|
|
375
|
+
declare function processContentWithEnv(content: string, config?: SpecraConfig): string;
|
|
376
|
+
/**
|
|
377
|
+
* Validate configuration (basic validation) (SERVER ONLY)
|
|
378
|
+
*/
|
|
379
|
+
declare function validateConfig(config: SpecraConfig): {
|
|
380
|
+
valid: boolean;
|
|
381
|
+
errors: string[];
|
|
382
|
+
};
|
|
383
|
+
declare function initConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
|
|
384
|
+
/**
|
|
385
|
+
* Get the configuration instance (cached) (SERVER ONLY)
|
|
386
|
+
*/
|
|
387
|
+
declare function getConfig(): SpecraConfig;
|
|
388
|
+
/**
|
|
389
|
+
* Reload the configuration (useful for development) (SERVER ONLY)
|
|
390
|
+
*/
|
|
391
|
+
declare function reloadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Simple API Documentation Format for Specra
|
|
395
|
+
* Easy to write, easy to parse
|
|
396
|
+
*/
|
|
397
|
+
interface ApiParam {
|
|
398
|
+
name: string;
|
|
399
|
+
type: string;
|
|
400
|
+
required?: boolean;
|
|
401
|
+
description?: string;
|
|
402
|
+
default?: any;
|
|
403
|
+
example?: any;
|
|
404
|
+
}
|
|
405
|
+
interface ApiHeader {
|
|
406
|
+
name: string;
|
|
407
|
+
value: string;
|
|
408
|
+
description?: string;
|
|
409
|
+
}
|
|
410
|
+
interface ApiResponse$1 {
|
|
411
|
+
status: number;
|
|
412
|
+
description?: string;
|
|
413
|
+
example?: any;
|
|
414
|
+
schema?: any;
|
|
415
|
+
}
|
|
416
|
+
interface ApiEndpointSpec {
|
|
417
|
+
title: string;
|
|
418
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
419
|
+
path: string;
|
|
420
|
+
description?: string;
|
|
421
|
+
pathParams?: ApiParam[];
|
|
422
|
+
queryParams?: ApiParam[];
|
|
423
|
+
headers?: ApiHeader[];
|
|
424
|
+
body?: {
|
|
425
|
+
description?: string;
|
|
426
|
+
example?: any;
|
|
427
|
+
schema?: any;
|
|
428
|
+
};
|
|
429
|
+
successResponse?: ApiResponse$1;
|
|
430
|
+
errorResponses?: ApiResponse$1[];
|
|
431
|
+
examples?: {
|
|
432
|
+
title: string;
|
|
433
|
+
language: string;
|
|
434
|
+
code: string;
|
|
435
|
+
}[];
|
|
436
|
+
}
|
|
437
|
+
interface SpecraApiSpec {
|
|
438
|
+
version?: string;
|
|
439
|
+
title?: string;
|
|
440
|
+
description?: string;
|
|
441
|
+
baseUrl: string;
|
|
442
|
+
env?: Record<string, string>;
|
|
443
|
+
globalHeaders?: ApiHeader[];
|
|
444
|
+
auth?: {
|
|
445
|
+
type: "bearer" | "apiKey" | "basic";
|
|
446
|
+
description?: string;
|
|
447
|
+
headerName?: string;
|
|
448
|
+
tokenPrefix?: string;
|
|
449
|
+
};
|
|
450
|
+
endpoints: ApiEndpointSpec[];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Base interface for all API spec parsers
|
|
455
|
+
*/
|
|
456
|
+
interface ApiSpecParser {
|
|
457
|
+
/**
|
|
458
|
+
* Parse the input spec and convert to Specra format
|
|
459
|
+
*/
|
|
460
|
+
parse(input: any): SpecraApiSpec;
|
|
461
|
+
/**
|
|
462
|
+
* Validate if the input is in the expected format
|
|
463
|
+
*/
|
|
464
|
+
validate(input: any): boolean;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Parser for native Specra API format
|
|
469
|
+
* This is a pass-through parser since the input is already in the correct format
|
|
470
|
+
*/
|
|
471
|
+
declare class SpecraParser implements ApiSpecParser {
|
|
472
|
+
validate(input: any): boolean;
|
|
473
|
+
parse(input: any): SpecraApiSpec;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Parser for OpenAPI 3.0/3.1 specifications
|
|
478
|
+
*/
|
|
479
|
+
declare class OpenApiParser implements ApiSpecParser {
|
|
480
|
+
validate(input: any): boolean;
|
|
481
|
+
parse(input: any): SpecraApiSpec;
|
|
482
|
+
private extractBaseUrl;
|
|
483
|
+
private extractAuth;
|
|
484
|
+
private parseOperation;
|
|
485
|
+
private convertPathParams;
|
|
486
|
+
private parseParameters;
|
|
487
|
+
private parseRequestBody;
|
|
488
|
+
private parseResponses;
|
|
489
|
+
private generateExample;
|
|
490
|
+
private resolveRef;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Parser for Postman Collection v2.0/v2.1
|
|
495
|
+
*/
|
|
496
|
+
declare class PostmanParser implements ApiSpecParser {
|
|
497
|
+
validate(input: any): boolean;
|
|
498
|
+
parse(input: any): SpecraApiSpec;
|
|
499
|
+
private extractBaseUrl;
|
|
500
|
+
private findFirstRequest;
|
|
501
|
+
private extractAuth;
|
|
502
|
+
private extractGlobalHeaders;
|
|
503
|
+
private parseItems;
|
|
504
|
+
private parseRequest;
|
|
505
|
+
private parseUrl;
|
|
506
|
+
private buildPath;
|
|
507
|
+
private parseUrlParams;
|
|
508
|
+
private parseBody;
|
|
509
|
+
private parseResponses;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
type ParserType = "auto" | "specra" | "openapi" | "postman";
|
|
513
|
+
/**
|
|
514
|
+
* Auto-detect the parser type based on the input structure
|
|
515
|
+
*/
|
|
516
|
+
declare function detectParserType(input: any): ParserType;
|
|
517
|
+
/**
|
|
518
|
+
* Parse an API spec using the specified or auto-detected parser
|
|
519
|
+
*/
|
|
520
|
+
declare function parseApiSpec(input: any, parserType?: ParserType): SpecraApiSpec;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Specra API Documentation Schema
|
|
524
|
+
* Supports REST, GraphQL, and WebSocket APIs
|
|
525
|
+
*/
|
|
526
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
527
|
+
interface ApiParameter {
|
|
528
|
+
name: string;
|
|
529
|
+
type: string;
|
|
530
|
+
required?: boolean;
|
|
531
|
+
description?: string;
|
|
532
|
+
default?: any;
|
|
533
|
+
example?: any;
|
|
534
|
+
enum?: string[];
|
|
535
|
+
}
|
|
536
|
+
interface ApiResponse {
|
|
537
|
+
status: number;
|
|
538
|
+
description: string;
|
|
539
|
+
schema?: any;
|
|
540
|
+
example?: any;
|
|
541
|
+
headers?: Record<string, string>;
|
|
542
|
+
}
|
|
543
|
+
interface ApiExample {
|
|
544
|
+
title: string;
|
|
545
|
+
language: string;
|
|
546
|
+
code: string;
|
|
547
|
+
}
|
|
548
|
+
interface ApiAuthentication {
|
|
549
|
+
type: "apiKey" | "bearer" | "basic" | "oauth2" | "none";
|
|
550
|
+
description?: string;
|
|
551
|
+
location?: "header" | "query" | "cookie";
|
|
552
|
+
name?: string;
|
|
553
|
+
scheme?: string;
|
|
554
|
+
}
|
|
555
|
+
interface RestEndpoint {
|
|
556
|
+
type: "rest";
|
|
557
|
+
method: HttpMethod;
|
|
558
|
+
path: string;
|
|
559
|
+
summary: string;
|
|
560
|
+
description?: string;
|
|
561
|
+
operationId?: string;
|
|
562
|
+
tags?: string[];
|
|
563
|
+
deprecated?: boolean;
|
|
564
|
+
authentication?: ApiAuthentication;
|
|
565
|
+
pathParams?: ApiParameter[];
|
|
566
|
+
queryParams?: ApiParameter[];
|
|
567
|
+
headers?: ApiParameter[];
|
|
568
|
+
body?: {
|
|
569
|
+
contentType: string;
|
|
570
|
+
schema?: any;
|
|
571
|
+
example?: any;
|
|
572
|
+
description?: string;
|
|
573
|
+
};
|
|
574
|
+
responses: ApiResponse[];
|
|
575
|
+
examples?: ApiExample[];
|
|
576
|
+
}
|
|
577
|
+
interface GraphQLField {
|
|
578
|
+
name: string;
|
|
579
|
+
type: string;
|
|
580
|
+
description?: string;
|
|
581
|
+
args?: ApiParameter[];
|
|
582
|
+
deprecated?: boolean;
|
|
583
|
+
deprecationReason?: string;
|
|
584
|
+
}
|
|
585
|
+
interface GraphQLType {
|
|
586
|
+
name: string;
|
|
587
|
+
kind: "OBJECT" | "INPUT_OBJECT" | "ENUM" | "SCALAR" | "INTERFACE" | "UNION";
|
|
588
|
+
description?: string;
|
|
589
|
+
fields?: GraphQLField[];
|
|
590
|
+
enumValues?: {
|
|
591
|
+
name: string;
|
|
592
|
+
description?: string;
|
|
593
|
+
}[];
|
|
594
|
+
}
|
|
595
|
+
interface GraphQLQuery {
|
|
596
|
+
type: "graphql";
|
|
597
|
+
operationType: "query" | "mutation" | "subscription";
|
|
598
|
+
name: string;
|
|
599
|
+
description?: string;
|
|
600
|
+
args?: ApiParameter[];
|
|
601
|
+
returnType: string;
|
|
602
|
+
example?: string;
|
|
603
|
+
response?: any;
|
|
604
|
+
}
|
|
605
|
+
interface GraphQLSchema {
|
|
606
|
+
queries?: GraphQLQuery[];
|
|
607
|
+
mutations?: GraphQLQuery[];
|
|
608
|
+
subscriptions?: GraphQLQuery[];
|
|
609
|
+
types?: GraphQLType[];
|
|
610
|
+
}
|
|
611
|
+
interface WebSocketEvent {
|
|
612
|
+
type: "websocket";
|
|
613
|
+
event: string;
|
|
614
|
+
direction: "client-to-server" | "server-to-client" | "bidirectional";
|
|
615
|
+
description?: string;
|
|
616
|
+
payload?: {
|
|
617
|
+
schema?: any;
|
|
618
|
+
example?: any;
|
|
619
|
+
};
|
|
620
|
+
response?: {
|
|
621
|
+
schema?: any;
|
|
622
|
+
example?: any;
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
interface WebSocketConnection {
|
|
626
|
+
url: string;
|
|
627
|
+
authentication?: ApiAuthentication;
|
|
628
|
+
description?: string;
|
|
629
|
+
events: WebSocketEvent[];
|
|
630
|
+
}
|
|
631
|
+
interface ApiDocumentation {
|
|
632
|
+
version: string;
|
|
633
|
+
title: string;
|
|
634
|
+
description?: string;
|
|
635
|
+
baseUrl?: string;
|
|
636
|
+
servers?: Array<{
|
|
637
|
+
url: string;
|
|
638
|
+
description?: string;
|
|
639
|
+
}>;
|
|
640
|
+
rest?: {
|
|
641
|
+
endpoints: RestEndpoint[];
|
|
642
|
+
};
|
|
643
|
+
graphql?: GraphQLSchema;
|
|
644
|
+
websocket?: WebSocketConnection[];
|
|
645
|
+
authentication?: ApiAuthentication[];
|
|
646
|
+
headers?: Record<string, string>;
|
|
647
|
+
}
|
|
648
|
+
interface ApiSpecConfig {
|
|
649
|
+
source: "openapi" | "postman" | "insomnia" | "specra" | "manual";
|
|
650
|
+
path?: string;
|
|
651
|
+
spec?: ApiDocumentation;
|
|
652
|
+
autoGenerate?: boolean;
|
|
653
|
+
outputDir?: string;
|
|
654
|
+
}
|
|
655
|
+
interface ParsedApiSpec {
|
|
656
|
+
source: ApiSpecConfig["source"];
|
|
657
|
+
documentation: ApiDocumentation;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
661
|
+
/**
|
|
662
|
+
* Get the correct asset path based on deployment configuration
|
|
663
|
+
* Handles different deployment scenarios:
|
|
664
|
+
* - Vercel/Node.js hosting (standalone build): No basePath needed
|
|
665
|
+
* - GitHub Pages without custom domain: Uses basePath from config
|
|
666
|
+
* - Static hosting with custom domain: No basePath needed
|
|
667
|
+
*
|
|
668
|
+
* @param path - The asset path (can start with or without '/')
|
|
669
|
+
* @returns The properly formatted asset path
|
|
670
|
+
*/
|
|
671
|
+
declare function getAssetPath(path: string): string;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Unified sidebar sorting and structure building utilities
|
|
675
|
+
* This module provides consistent sidebar logic across the application
|
|
676
|
+
* to ensure ordering is handled the same way everywhere.
|
|
677
|
+
*/
|
|
678
|
+
interface SidebarGroup {
|
|
679
|
+
label: string;
|
|
680
|
+
path: string;
|
|
681
|
+
icon?: string;
|
|
682
|
+
items: any[];
|
|
683
|
+
position: number;
|
|
684
|
+
collapsible: boolean;
|
|
685
|
+
defaultCollapsed: boolean;
|
|
686
|
+
children: Record<string, SidebarGroup>;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Sort sidebar items by their position.
|
|
690
|
+
* Items with explicit sidebar_position come first (sorted numerically),
|
|
691
|
+
* followed by items without position (sorted by their original order).
|
|
692
|
+
*
|
|
693
|
+
* @param items - Array of items with optional sidebar_position
|
|
694
|
+
* @returns Sorted array of items
|
|
695
|
+
*/
|
|
696
|
+
declare function sortSidebarItems<T extends {
|
|
697
|
+
sidebar_position?: number;
|
|
698
|
+
meta?: any;
|
|
699
|
+
}>(items: T[]): T[];
|
|
700
|
+
/**
|
|
701
|
+
* Sort sidebar groups by their position.
|
|
702
|
+
* Groups with explicit position come first (sorted numerically),
|
|
703
|
+
* followed by groups without position at the end (sorted by their original order).
|
|
704
|
+
*
|
|
705
|
+
* @param groups - Record of group key to group object with position
|
|
706
|
+
* @returns Sorted array of [key, group] tuples
|
|
707
|
+
*/
|
|
708
|
+
declare function sortSidebarGroups<T extends {
|
|
709
|
+
position: number;
|
|
710
|
+
}>(groups: Record<string, T>): [string, T][];
|
|
711
|
+
/**
|
|
712
|
+
* Build hierarchical sidebar structure from flat list of documents
|
|
713
|
+
* This is the single source of truth for sidebar structure used by both
|
|
714
|
+
* the sidebar component and navigation (prev/next) links.
|
|
715
|
+
*
|
|
716
|
+
* @param docs - Array of documents with metadata
|
|
717
|
+
* @returns Object containing root groups and standalone items
|
|
718
|
+
*/
|
|
719
|
+
declare function buildSidebarStructure<T extends {
|
|
720
|
+
filePath: string;
|
|
721
|
+
slug: string;
|
|
722
|
+
categoryLabel?: string;
|
|
723
|
+
categoryPosition?: number;
|
|
724
|
+
categoryIcon?: string;
|
|
725
|
+
categoryCollapsible?: boolean;
|
|
726
|
+
categoryCollapsed?: boolean;
|
|
727
|
+
meta: any;
|
|
728
|
+
}>(docs: T[]): {
|
|
729
|
+
rootGroups: Record<string, SidebarGroup>;
|
|
730
|
+
standalone: T[];
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
interface CategoryConfig {
|
|
734
|
+
label?: string;
|
|
735
|
+
position?: number;
|
|
736
|
+
sidebar_position?: number;
|
|
737
|
+
link?: {
|
|
738
|
+
type: "generated-index" | "doc";
|
|
739
|
+
slug?: string;
|
|
740
|
+
};
|
|
741
|
+
collapsed?: boolean;
|
|
742
|
+
collapsible?: boolean;
|
|
743
|
+
icon?: string;
|
|
744
|
+
tab_group?: string;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Read category.json from a folder
|
|
748
|
+
*/
|
|
749
|
+
declare function getCategoryConfig(folderPath: string): CategoryConfig | null;
|
|
750
|
+
/**
|
|
751
|
+
* Get all category configs for a version
|
|
752
|
+
*/
|
|
753
|
+
declare function getAllCategoryConfigs(version: string): Map<string, CategoryConfig>;
|
|
754
|
+
|
|
755
|
+
interface RedirectMapping {
|
|
756
|
+
from: string;
|
|
757
|
+
to: string;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Build redirect mappings from all docs' redirect_from frontmatter
|
|
761
|
+
*/
|
|
762
|
+
declare function buildRedirectMappings(): Promise<RedirectMapping[]>;
|
|
763
|
+
/**
|
|
764
|
+
* Find redirect destination for a given path
|
|
765
|
+
*/
|
|
766
|
+
declare function findRedirect(path: string): Promise<string | null>;
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Development utilities for debugging and performance monitoring
|
|
770
|
+
* Only active in development mode
|
|
771
|
+
*/
|
|
772
|
+
/**
|
|
773
|
+
* Performance timer for measuring operation duration
|
|
774
|
+
*/
|
|
775
|
+
declare class PerfTimer {
|
|
776
|
+
private startTime;
|
|
777
|
+
private label;
|
|
778
|
+
constructor(label: string);
|
|
779
|
+
end(): void;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Log file system operations
|
|
783
|
+
*/
|
|
784
|
+
declare function logFsOperation(operation: string, path: string, details?: any): void;
|
|
785
|
+
/**
|
|
786
|
+
* Log cache operations
|
|
787
|
+
*/
|
|
788
|
+
declare function logCacheOperation(operation: 'hit' | 'miss' | 'invalidate', key: string): void;
|
|
789
|
+
/**
|
|
790
|
+
* Memory usage reporter
|
|
791
|
+
*/
|
|
792
|
+
declare function logMemoryUsage(label?: string): void;
|
|
793
|
+
/**
|
|
794
|
+
* Pretty print object for debugging
|
|
795
|
+
*/
|
|
796
|
+
declare function debugLog(label: string, data: any): void;
|
|
797
|
+
|
|
798
|
+
export { type AnalyticsConfig, type ApiAuthentication, type ApiDocumentation, type ApiEndpointSpec, type ApiExample, type ApiHeader, type ApiParam, type ApiParameter, type ApiResponse, type ApiSpecConfig, type ApiSpecParser, type BannerConfig, type CategoryConfig, type DeploymentConfig, type Doc, type DocMeta, type EnvironmentVariables, type FeaturesConfig, type FooterConfig, type GraphQLField, type GraphQLQuery, type GraphQLSchema, type GraphQLType, type HttpMethod, type NavigationConfig, OpenApiParser, type ParsedApiSpec, type ParserType, PerfTimer, PostmanParser, type RedirectMapping, type RestEndpoint, type SearchConfig, type SidebarGroup, type SiteConfig, type SocialLinks, type ApiResponse$1 as SpecraApiResponse, type SpecraApiSpec, type SpecraConfig, SpecraParser, type TOCItem, type TabGroup, type ThemeConfig, type TocItem, type WebSocketConnection, type WebSocketEvent, buildRedirectMappings, buildSidebarStructure, clearAllCaches, cn, debugLog, defaultConfig, detectParserType, extractHeadings, extractTableOfContents, findRedirect, getAdjacentDocs, getAllCategoryConfigs, getAllDocs, getAssetPath, getCacheStats, getCachedAllDocs, getCachedDocBySlug, getCachedVersions, getCategoryConfig, getConfig, getConfigValue, getDocBySlug, getVersions, initConfig, isCategoryPage, loadConfig, logCacheOperation, logFsOperation, logMemoryUsage, parseApiSpec, processContentWithEnv, reloadConfig, replaceEnvVariables, sortSidebarGroups, sortSidebarItems, validateConfig };
|