@openpkg-ts/sdk 0.30.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +805 -806
  2. package/dist/index.js +5434 -5432
  3. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -1,404 +1,323 @@
1
- interface ListExportsOptions {
2
- /** Entry point file path */
3
- entryFile: string;
4
- /** Base directory for resolution */
5
- baseDir?: string;
6
- /** Optional in-memory content (for testing) */
7
- content?: string;
8
- }
9
- interface ExportItem {
10
- /** Export name */
11
- name: string;
12
- /** Export kind */
13
- kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "namespace";
14
- /** Source file path */
15
- file: string;
16
- /** Line number (1-indexed) */
17
- line: number;
18
- /** JSDoc description (first line, max 80 chars) */
19
- description?: string;
20
- /** Whether is deprecated */
21
- deprecated?: boolean;
22
- /** Whether this is a re-from another module */
23
- reexport?: boolean;
24
- }
25
- interface ListExportsResult {
26
- exports: ExportItem[];
27
- errors: string[];
28
- }
1
+ import { BreakingSeverity, CategorizedBreaking, calculateNextVersion, categorizeBreakingChanges, diffSpec, diffSpec as diffSpec2, MemberChangeInfo, recommendSemverBump, SemverBump, SemverRecommendation, SpecDiff } from "@openpkg-ts/spec";
2
+ import { SpecMember } from "@openpkg-ts/spec";
29
3
  /**
30
- * List all exports from a TypeScript entry point
4
+ * Extract badge strings from a member's visibility and flags.
5
+ * Handles: visibility (if not public), static, readonly, async, abstract
31
6
  */
32
- declare function listExports(options: ListExportsOptions): Promise<ListExportsResult>;
33
- import { SpecExport, SpecType } from "@openpkg-ts/spec";
34
- interface GetExportOptions {
35
- /** Entry point file path */
36
- entryFile: string;
37
- /** Export name to get */
38
- exportName: string;
39
- /** Base directory for resolution */
40
- baseDir?: string;
41
- /** Optional in-memory content (for testing) */
42
- content?: string;
43
- /** Max depth for type resolution */
44
- maxTypeDepth?: number;
45
- }
46
- interface GetExportResult {
47
- /** The spec, or null if not found */
48
- export: SpecExport | null;
49
- /** Related types referenced by the */
50
- types: SpecType[];
51
- /** Errors encountered */
52
- errors: string[];
53
- }
54
- /**
55
- * Get detailed spec for a single */
56
- declare function getExport2(options: GetExportOptions): Promise<GetExportResult>;
57
- import { OpenPkg } from "@openpkg-ts/spec";
58
- interface ExtractOptions {
59
- entryFile: string;
60
- baseDir?: string;
61
- content?: string;
62
- maxTypeDepth?: number;
63
- maxExternalTypeDepth?: number;
64
- resolveExternalTypes?: boolean;
65
- schemaExtraction?: "static" | "hybrid";
66
- /** Target JSON Schema dialect for runtime schema extraction */
67
- schemaTarget?: "draft-2020-12" | "draft-07" | "openapi-3.0";
68
- /** Include $schema URL in output */
69
- includeSchema?: boolean;
70
- /** Only extract these exports (supports * wildcards) */
71
- only?: string[];
72
- /** Ignore these exports (supports * wildcards) */
73
- ignore?: string[];
74
- /** Progress callback for tracking extraction progress */
75
- onProgress?: (current: number, total: number, item: string) => void;
76
- /** Whether source is a .d.ts file (degraded mode - TSDoc may be missing) */
77
- isDtsSource?: boolean;
78
- }
79
- interface ExtractResult {
80
- spec: OpenPkg;
81
- diagnostics: Diagnostic[];
82
- forgottenExports?: ForgottenExport[];
83
- /** Metadata about runtime schema extraction (when schemaExtraction: 'hybrid') */
84
- runtimeSchemas?: {
85
- /** Number of schema exports found */
86
- extracted: number;
87
- /** Number of schemas successfully merged with static types */
88
- merged: number;
89
- /** Schema vendors detected (e.g., 'zod', 'arktype', 'valibot', 'typebox') */
90
- vendors: string[];
91
- /** Any errors encountered during runtime extraction */
92
- errors: string[];
93
- /** Extraction method used: 'compiled' or 'direct-ts (runtime)' */
94
- method?: string;
95
- };
96
- /** Degraded mode info when extracting from .d.ts files */
97
- degradedMode?: {
98
- reason: "dts-source";
99
- stats: {
100
- exportsWithoutDescription: number;
101
- paramsWithoutDocs: number;
102
- missingExamples: number;
103
- };
104
- };
105
- /** Export verification comparing discovered vs extracted */
106
- verification?: ExportVerification;
107
- }
108
- interface Diagnostic {
109
- message: string;
110
- severity: "error" | "warning" | "info";
111
- code?: string;
112
- suggestion?: string;
113
- location?: {
114
- file?: string;
115
- line?: number;
116
- column?: number;
117
- };
118
- }
119
- /** Context tracking for type references in public API */
120
- interface TypeReference2 {
121
- typeName: string;
122
- exportName: string;
123
- location: "return" | "parameter" | "property" | "extends" | "type-parameter";
124
- path?: string;
125
- }
126
- /** Structured data for forgotten exports */
127
- interface ForgottenExport {
128
- name: string;
129
- definedIn?: string;
130
- referencedBy: TypeReference2[];
131
- isExternal: boolean;
132
- fix?: string;
133
- }
134
- /** Tracks status of each discovered through serialization pipeline */
135
- interface ExportTracker {
136
- name: string;
137
- discovered: boolean;
138
- status: "pending" | "success" | "skipped" | "failed";
139
- skipReason?: "filtered" | "no-declaration" | "internal";
140
- error?: string;
141
- kind?: string;
142
- }
143
- /** Verification result comparing discovered vs extracted exports */
144
- interface ExportVerification {
145
- /** Total exports discovered by TypeScript */
146
- discovered: number;
147
- /** Exports successfully extracted */
148
- extracted: number;
149
- /** Exports skipped (filtered, no-declaration, internal) */
150
- skipped: number;
151
- /** Exports that failed during serialization */
152
- failed: number;
153
- /** Delta: discovered - extracted */
154
- delta: number;
155
- details: {
156
- skipped: Array<{
157
- name: string;
158
- reason: "filtered" | "no-declaration" | "internal";
159
- }>;
160
- failed: Array<{
161
- name: string;
162
- error: string;
163
- }>;
164
- };
165
- }
7
+ declare function getMemberBadges(member: SpecMember): string[];
166
8
  /**
167
- * Extract full OpenPkg spec from a TypeScript entry point
168
- *
169
- * @example
170
- * ```typescript
171
- * import { extractSpec } from '@openpkg-ts/sdk';
172
- *
173
- * const result = await extractSpec({
174
- * entryFile: './src/index.ts'
175
- * });
176
- *
177
- * console.log(result.spec.exports.length);
178
- * ```
9
+ * Format badges array into a display string (space-separated).
179
10
  */
180
- declare const extractSpec: (options: ExtractOptions) => Promise<ExtractResult>;
181
- import { diffSpec, categorizeBreakingChanges, recommendSemverBump, calculateNextVersion, SpecDiff, BreakingSeverity, CategorizedBreaking, MemberChangeInfo, SemverBump, SemverRecommendation } from "@openpkg-ts/spec";
182
- import { diffSpec as diffSpec2 } from "@openpkg-ts/spec";
183
- import { OpenPkg as OpenPkg2, SpecExport as SpecExport2, SpecMember, SpecSchema, SpecSignature, SpecType as SpecType2, SpecTypeParameter } from "@openpkg-ts/spec";
184
- interface FormatSchemaOptions {
185
- /** Include package attribution for external types */
186
- includePackage?: boolean;
11
+ declare function formatBadges(badges: string[]): string;
12
+ import { OpenPkg as OpenPkg6, SpecExport as SpecExport2, SpecExportKind as SpecExportKind4, SpecType } from "@openpkg-ts/spec";
13
+ import { OpenPkg } from "@openpkg-ts/spec";
14
+ interface HTMLOptions {
15
+ /** Page title override */
16
+ title?: string;
17
+ /** Include inline styles */
18
+ includeStyles?: boolean;
19
+ /** Custom CSS to inject */
20
+ customCSS?: string;
21
+ /** Custom head content */
22
+ headContent?: string;
23
+ /** Wrap in full HTML document */
24
+ fullDocument?: boolean;
25
+ /** Export to render (single mode) */
26
+ export?: string;
187
27
  }
188
28
  /**
189
- * Format a schema to a human-readable type string.
29
+ * Render spec to standalone HTML page.
190
30
  *
191
- * @param schema - The schema to format
192
- * @param options - Formatting options
193
- * @returns Formatted type string
31
+ * @param spec - The OpenPkg spec to render
32
+ * @param options - HTML rendering options
33
+ * @returns Complete HTML document or fragment
194
34
  *
195
35
  * @example
196
36
  * ```ts
197
- * formatSchema({ type: 'string' }) // 'string'
198
- * formatSchema({ $ref: '#/types/User' }) // 'User'
199
- * formatSchema({ anyOf: [{ type: 'string' }, { type: 'number' }] }) // 'string | number'
200
- * formatSchema({ type: 'integer', 'x-ts-type': 'bigint' }) // 'bigint'
201
- * formatSchema({ 'x-ts-type': 'Response', 'x-ts-package': 'express' }, { includePackage: true }) // 'Response (from express)'
202
- * ```
203
- */
204
- declare function formatSchema(schema: SpecSchema | undefined, options?: FormatSchemaOptions): string;
205
- /**
206
- * Format type parameters to a string like `<T, U extends string>`.
37
+ * import { createDocs } from '@openpkg-ts/sdk'
207
38
  *
208
- * @param typeParams - Array of type parameters
209
- * @returns Formatted type parameters string or empty string
39
+ * const docs = createDocs('./openpkg.json')
210
40
  *
211
- * @example
212
- * ```ts
213
- * formatTypeParameters([{ name: 'T' }]) // '<T>'
214
- * formatTypeParameters([{ name: 'T', constraint: 'object' }]) // '<T extends object>'
215
- * formatTypeParameters([{ name: 'T', default: 'unknown' }]) // '<T = unknown>'
216
- * formatTypeParameters([{ name: 'T', variance: 'in' }]) // '<in T>'
41
+ * // Full HTML page
42
+ * const html = docs.toHTML({ includeStyles: true })
43
+ * fs.writeFileSync('api.html', html)
44
+ *
45
+ * // Single export, no document wrapper
46
+ * const fragment = docs.toHTML({ export: 'greet', fullDocument: false })
217
47
  * ```
218
48
  */
219
- declare function formatTypeParameters(typeParams?: SpecTypeParameter[]): string;
49
+ declare function toHTML2(spec: OpenPkg, options?: HTMLOptions): string;
50
+ import { OpenPkg as OpenPkg2, SpecExportKind } from "@openpkg-ts/spec";
51
+ interface JSONOptions {
52
+ /** Include raw spec data alongside simplified data */
53
+ includeRaw?: boolean;
54
+ /** Export to render (single mode) */
55
+ export?: string;
56
+ /** Include computed fields (signatures, formatted types) */
57
+ computed?: boolean;
58
+ /** Flatten nested structures */
59
+ flatten?: boolean;
60
+ }
61
+ interface SimplifiedParameter {
62
+ name: string;
63
+ type: string;
64
+ required: boolean;
65
+ description?: string;
66
+ default?: unknown;
67
+ rest?: boolean;
68
+ }
69
+ interface SimplifiedReturn {
70
+ type: string;
71
+ description?: string;
72
+ }
73
+ interface SimplifiedSignature {
74
+ parameters: SimplifiedParameter[];
75
+ returns?: SimplifiedReturn;
76
+ description?: string;
77
+ typeParameters?: string[];
78
+ }
79
+ interface SimplifiedMember {
80
+ name: string;
81
+ kind: "property" | "method";
82
+ type?: string;
83
+ description?: string;
84
+ visibility?: "public" | "protected" | "private";
85
+ signature?: SimplifiedSignature;
86
+ }
87
+ interface SimplifiedExample {
88
+ code: string;
89
+ title?: string;
90
+ description?: string;
91
+ language?: string;
92
+ }
93
+ interface SimplifiedExport {
94
+ id: string;
95
+ name: string;
96
+ kind: SpecExportKind;
97
+ signature: string;
98
+ description?: string;
99
+ deprecated: boolean;
100
+ tags: Array<{
101
+ name: string;
102
+ text: string;
103
+ }>;
104
+ parameters?: SimplifiedParameter[];
105
+ returns?: SimplifiedReturn;
106
+ members?: SimplifiedMember[];
107
+ examples?: SimplifiedExample[];
108
+ extends?: string;
109
+ implements?: string[];
110
+ sourceFile?: string;
111
+ sourceLine?: number;
112
+ }
113
+ interface SimplifiedSpec {
114
+ name: string;
115
+ version?: string;
116
+ description?: string;
117
+ exports: SimplifiedExport[];
118
+ byKind: Record<SpecExportKind, SimplifiedExport[]>;
119
+ totalExports: number;
120
+ }
220
121
  /**
221
- * Format function parameters to a string like `(a: string, b?: number)`.
122
+ * Render spec to simplified JSON structure.
222
123
  *
223
- * @param sig - The signature containing parameters
224
- * @returns Formatted parameters string
124
+ * @param spec - The OpenPkg spec to simplify
125
+ * @param options - JSON rendering options
126
+ * @returns Simplified spec or single structure
225
127
  *
226
128
  * @example
227
129
  * ```ts
228
- * formatParameters({ parameters: [{ name: 'id', schema: { type: 'string' } }] })
229
- * // '(id: string)'
230
- * ```
231
- */
232
- declare function formatParameters(sig?: SpecSignature): string;
233
- /**
234
- * Format return type from signature.
130
+ * import { createDocs } from '@openpkg-ts/sdk'
235
131
  *
236
- * @param sig - The signature containing return type
237
- * @returns Formatted return type string
132
+ * const docs = createDocs('./openpkg.json')
238
133
  *
239
- * @example
240
- * ```ts
241
- * formatReturnType({ returns: { schema: { type: 'Promise', items: { type: 'string' } } } })
242
- * // 'Promise<string>'
134
+ * // Full spec as simplified JSON
135
+ * const json = docs.toJSON()
136
+ * // { name, version, exports: [...], byKind: {...} }
137
+ *
138
+ * // Single * const fnJson = docs.toJSON({ export: 'greet' })
139
+ * // { id, name, kind, signature, parameters, returns, ... }
243
140
  * ```
244
141
  */
245
- declare function formatReturnType(sig?: SpecSignature): string;
142
+ declare function toJSON2(spec: OpenPkg2, options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
246
143
  /**
247
- * Build a full signature string for an export.
248
- *
249
- * @param exp - The to build a signature for
250
- * @param sigIndex - Index of signature to use for overloaded functions
251
- * @returns Complete signature string
252
- *
253
- * @example
254
- * ```ts
255
- * buildSignatureString({ kind: 'function', name: 'greet', signatures: [...] })
256
- * // 'function greet(name: string): string'
144
+ * Serialize to JSON string with formatting.
257
145
  *
258
- * buildSignatureString({ kind: 'class', name: 'Logger', extends: 'EventEmitter' })
259
- * // 'class Logger extends EventEmitter'
260
- * ```
146
+ * @param spec - The OpenPkg spec to serialize
147
+ * @param options - JSON options plus pretty formatting option
148
+ * @returns JSON string
261
149
  */
262
- declare function buildSignatureString(exp: SpecExport2, sigIndex?: number): string;
150
+ declare function toJSONString(spec: OpenPkg2, options?: JSONOptions & {
151
+ pretty?: boolean;
152
+ }): string;
153
+ import { OpenPkg as OpenPkg3, SpecExport } from "@openpkg-ts/spec";
154
+ interface MarkdownOptions {
155
+ /** Include frontmatter in output */
156
+ frontmatter?: boolean;
157
+ /** Sections to include */
158
+ sections?: {
159
+ signature?: boolean;
160
+ description?: boolean;
161
+ parameters?: boolean;
162
+ returns?: boolean;
163
+ examples?: boolean;
164
+ members?: boolean;
165
+ properties?: boolean;
166
+ methods?: boolean;
167
+ };
168
+ /** Custom frontmatter fields */
169
+ customFrontmatter?: Record<string, unknown>;
170
+ /** Use code fences for signatures */
171
+ codeSignatures?: boolean;
172
+ /** Heading level offset (0 = starts at h1, 1 = starts at h2) */
173
+ headingOffset?: number;
174
+ }
175
+ interface ExportMarkdownOptions extends MarkdownOptions {
176
+ /** Export to render */
177
+ export?: string;
178
+ }
263
179
  /**
264
- * Resolve a type reference to its definition.
180
+ * Render a single to MDX.
265
181
  *
266
- * @param ref - Type reference string (e.g., '#/types/User')
267
- * @param spec - The OpenPkg spec containing type definitions
268
- * @returns The resolved type definition or undefined
182
+ * @param exp - The to render
183
+ * @param options - Markdown rendering options
184
+ * @returns MDX string with frontmatter
269
185
  *
270
186
  * @example
271
187
  * ```ts
272
- * resolveTypeRef('#/types/User', spec)
273
- * // { id: 'User', name: 'User', kind: 'interface', ... }
188
+ * const mdx = exportToMarkdown(fn, {
189
+ * frontmatter: true,
190
+ * codeSignatures: true,
191
+ * sections: { examples: true }
192
+ * })
274
193
  * ```
275
194
  */
276
- declare function resolveTypeRef(ref: string, spec: OpenPkg2): SpecType2 | undefined;
195
+ declare function exportToMarkdown(exp: SpecExport, options?: MarkdownOptions): string;
277
196
  /**
278
- * Check if a member is a method (has signatures).
197
+ * Render entire spec to MDX.
279
198
  *
280
- * @param member - The member to check
281
- * @returns True if the member is a method
199
+ * @param spec - The OpenPkg spec to render
200
+ * @param options - Markdown options, optionally with name for single mode
201
+ * @returns MDX string
282
202
  *
283
203
  * @example
284
204
  * ```ts
285
- * isMethod({ name: 'foo', signatures: [{ parameters: [] }] }) // true
286
- * isMethod({ name: 'bar', schema: { type: 'string' } }) // false
287
- * ```
288
- */
289
- declare function isMethod(member: SpecMember): boolean;
290
- /**
291
- * Check if a member is a property (no signatures).
205
+ * import { createDocs } from '@openpkg-ts/sdk'
292
206
  *
293
- * @param member - The member to check
294
- * @returns True if the member is a property
295
- */
296
- declare function isProperty(member: SpecMember): boolean;
297
- /**
298
- * Get methods from members list.
207
+ * const docs = createDocs('./openpkg.json')
299
208
  *
300
- * @param members - Array of members to filter
301
- * @returns Array of method members
302
- */
303
- declare function getMethods(members?: SpecMember[]): SpecMember[];
304
- /**
305
- * Get properties from members list.
209
+ * // Full spec
210
+ * const fullMdx = docs.toMarkdown()
306
211
  *
307
- * @param members - Array of members to filter
308
- * @returns Array of property members
212
+ * // Single * const fnMdx = docs.toMarkdown({ export: 'greet' })
213
+ * ```
309
214
  */
310
- declare function getProperties(members?: SpecMember[]): SpecMember[];
215
+ declare function toMarkdown2(spec: OpenPkg3, options?: ExportMarkdownOptions): string;
216
+ import { OpenPkg as OpenPkg4, SpecExportKind as SpecExportKind2 } from "@openpkg-ts/spec";
217
+ type NavFormat = "fumadocs" | "docusaurus" | "generic";
218
+ type GroupBy = "kind" | "module" | "tag" | "none";
219
+ interface NavOptions {
220
+ /** Output format */
221
+ format?: NavFormat;
222
+ /** How to group exports */
223
+ groupBy?: GroupBy;
224
+ /** Base path for links */
225
+ basePath?: string;
226
+ /** Custom slug generator */
227
+ slugify?: (name: string) => string;
228
+ /** Include index pages for groups */
229
+ includeGroupIndex?: boolean;
230
+ /** Custom kind labels */
231
+ kindLabels?: Partial<Record<SpecExportKind2, string>>;
232
+ /** Sort exports alphabetically */
233
+ sortAlphabetically?: boolean;
234
+ }
235
+ interface NavItem {
236
+ title: string;
237
+ href?: string;
238
+ items?: NavItem[];
239
+ }
240
+ interface NavGroup {
241
+ title: string;
242
+ items: NavItem[];
243
+ index?: string;
244
+ }
245
+ interface GenericNav {
246
+ title: string;
247
+ groups: NavGroup[];
248
+ items: NavItem[];
249
+ }
250
+ interface FumadocsMetaItem {
251
+ title: string;
252
+ pages?: string[];
253
+ defaultOpen?: boolean;
254
+ }
255
+ interface FumadocsMeta {
256
+ root?: boolean;
257
+ title?: string;
258
+ pages?: (string | FumadocsMetaItem)[];
259
+ }
260
+ interface DocusaurusSidebarItem {
261
+ type: "category" | "doc" | "link";
262
+ label: string;
263
+ items?: DocusaurusSidebarItem[];
264
+ id?: string;
265
+ href?: string;
266
+ }
267
+ type DocusaurusSidebar = DocusaurusSidebarItem[];
311
268
  /**
312
- * Group members by visibility (public, protected, private).
269
+ * Generate navigation structure for doc frameworks.
313
270
  *
314
- * @param members - Array of members to group
315
- * @returns Object with public, protected, and private arrays
271
+ * @param spec - The OpenPkg spec
272
+ * @param options - Navigation options including format and grouping
273
+ * @returns Navigation structure in requested format
316
274
  *
317
275
  * @example
318
276
  * ```ts
319
- * const groups = groupByVisibility(classExport.members)
320
- * groups.public // [{ name: 'foo', visibility: 'public' }]
321
- * groups.private // [{ name: 'bar', visibility: 'private' }]
322
- * ```
323
- */
324
- declare function groupByVisibility(members?: SpecMember[]): {
325
- public: SpecMember[];
326
- protected: SpecMember[];
327
- private: SpecMember[];
328
- };
329
- /**
330
- * Sort exports alphabetically by name.
277
+ * import { createDocs } from '@openpkg-ts/sdk'
331
278
  *
332
- * @param items - Array of items with a name property
333
- * @returns New sorted array
334
- */
335
- declare function sortByName<T extends {
336
- name: string;
337
- }>(items: T[]): T[];
338
- /**
339
- * Conditional type structure from the spec.
340
- */
341
- interface SpecConditionalType {
342
- checkType: SpecSchema;
343
- extendsType: SpecSchema;
344
- trueType: SpecSchema;
345
- falseType: SpecSchema;
346
- }
347
- /**
348
- * Mapped type structure from the spec.
279
+ * const docs = createDocs('./openpkg.json')
280
+ *
281
+ * // Generic nav
282
+ * const nav = docs.toNavigation({ format: 'generic', groupBy: 'kind' })
283
+ *
284
+ * // Fumadocs meta.json
285
+ * const meta = docs.toNavigation({ format: 'fumadocs' })
286
+ *
287
+ * // Docusaurus sidebar
288
+ * const sidebar = docs.toNavigation({ format: 'docusaurus' })
289
+ * ```
349
290
  */
350
- interface SpecMappedType {
351
- keyType: SpecSchema;
352
- valueType: SpecSchema;
353
- readonly?: boolean | "add" | "remove";
354
- optional?: boolean | "add" | "remove";
355
- }
291
+ declare function toNavigation2(spec: OpenPkg4, options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
356
292
  /**
357
- * Format a conditional type to a human-readable string.
293
+ * Generate Fumadocs meta.json file content.
358
294
  *
359
- * @param condType - The conditional type structure
360
- * @returns Formatted conditional type string
295
+ * @param spec - The OpenPkg spec
296
+ * @param options - Navigation options (format is forced to fumadocs)
297
+ * @returns JSON string for meta.json file
361
298
  *
362
299
  * @example
363
300
  * ```ts
364
- * formatConditionalType({
365
- * checkType: { 'x-ts-type': 'T' },
366
- * extendsType: { type: 'string' },
367
- * trueType: { type: 'boolean', const: true },
368
- * falseType: { type: 'boolean', const: false }
369
- * })
370
- * // 'T extends string ? true : false'
301
+ * const meta = toFumadocsMetaJSON(spec, { groupBy: 'kind' })
302
+ * fs.writeFileSync('docs/api/meta.json', meta)
371
303
  * ```
372
304
  */
373
- declare function formatConditionalType(condType: SpecConditionalType): string;
305
+ declare function toFumadocsMetaJSON(spec: OpenPkg4, options?: Omit<NavOptions, "format">): string;
374
306
  /**
375
- * Format a mapped type to a human-readable string.
307
+ * Generate Docusaurus sidebar config.
376
308
  *
377
- * @param mappedType - The mapped type structure
378
- * @returns Formatted mapped type string
309
+ * @param spec - The OpenPkg spec
310
+ * @param options - Navigation options (format is forced to docusaurus)
311
+ * @returns JavaScript module.exports string for sidebars.js
379
312
  *
380
313
  * @example
381
314
  * ```ts
382
- * formatMappedType({
383
- * keyType: { 'x-ts-type': 'K in keyof T' },
384
- * valueType: { 'x-ts-type': 'T[K]' },
385
- * readonly: true
386
- * })
387
- * // '{ readonly [K in keyof T]: T[K] }'
315
+ * const sidebar = toDocusaurusSidebarJS(spec, { basePath: 'api' })
316
+ * fs.writeFileSync('sidebars.js', sidebar)
388
317
  * ```
389
318
  */
390
- declare function formatMappedType(mappedType: SpecMappedType): string;
391
- import { SpecMember as SpecMember2 } from "@openpkg-ts/spec";
392
- /**
393
- * Extract badge strings from a member's visibility and flags.
394
- * Handles: visibility (if not public), static, readonly, async, abstract
395
- */
396
- declare function getMemberBadges(member: SpecMember2): string[];
397
- /**
398
- * Format badges array into a display string (space-separated).
399
- */
400
- declare function formatBadges(badges: string[]): string;
401
- import { OpenPkg as OpenPkg3, SpecExportKind } from "@openpkg-ts/spec";
319
+ declare function toDocusaurusSidebarJS(spec: OpenPkg4, options?: Omit<NavOptions, "format">): string;
320
+ import { OpenPkg as OpenPkg5, SpecExportKind as SpecExportKind3 } from "@openpkg-ts/spec";
402
321
  interface SearchOptions {
403
322
  /** Base URL for search result links */
404
323
  baseUrl?: string;
@@ -442,7 +361,7 @@ interface PagefindRecord {
442
361
  interface AlgoliaRecord {
443
362
  objectID: string;
444
363
  name: string;
445
- kind: SpecExportKind;
364
+ kind: SpecExportKind3;
446
365
  description?: string;
447
366
  signature: string;
448
367
  content: string;
@@ -462,7 +381,7 @@ interface AlgoliaRecord {
462
381
  interface SearchRecord {
463
382
  id: string;
464
383
  name: string;
465
- kind: SpecExportKind;
384
+ kind: SpecExportKind3;
466
385
  signature: string;
467
386
  description?: string;
468
387
  content: string;
@@ -470,459 +389,539 @@ interface SearchRecord {
470
389
  url: string;
471
390
  deprecated: boolean;
472
391
  }
473
- interface SearchIndex {
474
- records: SearchRecord[];
475
- version: string;
476
- generatedAt: string;
477
- packageName: string;
478
- }
479
- /**
480
- * Generate search index from spec.
481
- *
482
- * @param spec - The OpenPkg spec to index
483
- * @param options - Search index configuration
484
- * @returns Search index with records for each *
485
- * @example
486
- * ```ts
487
- * import { createDocs } from '@openpkg-ts/sdk'
488
- *
489
- * const docs = createDocs('./openpkg.json')
490
- * const index = docs.toSearchIndex({ baseUrl: '/api' })
491
- * // { records: [...], version: '1.0.0', packageName: 'my-lib' }
492
- * ```
493
- */
494
- declare function toSearchIndex2(spec: OpenPkg3, options?: SearchOptions): SearchIndex;
495
- /**
496
- * Generate Pagefind-compatible records.
497
- *
498
- * @param spec - The OpenPkg spec to index
499
- * @param options - Search configuration including weights
500
- * @returns Array of Pagefind-compatible search records
501
- *
502
- * @example
503
- * ```ts
504
- * const records = toPagefindRecords(spec, {
505
- * baseUrl: '/docs/api',
506
- * weights: { name: 10, description: 5 }
507
- * })
508
- * ```
509
- */
510
- declare function toPagefindRecords2(spec: OpenPkg3, options?: SearchOptions): PagefindRecord[];
511
- /**
512
- * Generate Algolia-compatible records.
513
- *
514
- * @param spec - The OpenPkg spec to index
515
- * @param options - Search configuration
516
- * @returns Array of Algolia-compatible search records with hierarchy
517
- *
518
- * @example
519
- * ```ts
520
- * const records = toAlgoliaRecords(spec, { baseUrl: '/api' })
521
- * // Upload to Algolia index
522
- * ```
523
- */
524
- declare function toAlgoliaRecords2(spec: OpenPkg3, options?: SearchOptions): AlgoliaRecord[];
525
- /**
526
- * Serialize search index to JSON string.
527
- *
528
- * @param spec - The OpenPkg spec to index
529
- * @param options - Search options plus pretty formatting option
530
- * @returns JSON string of search index
531
- *
532
- * @example
533
- * ```ts
534
- * const json = toSearchIndexJSON(spec, { pretty: true })
535
- * fs.writeFileSync('search-index.json', json)
536
- * ```
537
- */
538
- declare function toSearchIndexJSON(spec: OpenPkg3, options?: SearchOptions & {
539
- pretty?: boolean;
540
- }): string;
541
- import { OpenPkg as OpenPkg8, SpecExport as SpecExport4, SpecExportKind as SpecExportKind4, SpecType as SpecType3 } from "@openpkg-ts/spec";
542
- import { OpenPkg as OpenPkg4 } from "@openpkg-ts/spec";
543
- interface HTMLOptions {
544
- /** Page title override */
545
- title?: string;
546
- /** Include inline styles */
547
- includeStyles?: boolean;
548
- /** Custom CSS to inject */
549
- customCSS?: string;
550
- /** Custom head content */
551
- headContent?: string;
552
- /** Wrap in full HTML document */
553
- fullDocument?: boolean;
554
- /** Export to render (single mode) */
555
- export?: string;
556
- }
557
- /**
558
- * Render spec to standalone HTML page.
559
- *
560
- * @param spec - The OpenPkg spec to render
561
- * @param options - HTML rendering options
562
- * @returns Complete HTML document or fragment
563
- *
564
- * @example
565
- * ```ts
566
- * import { createDocs } from '@openpkg-ts/sdk'
567
- *
568
- * const docs = createDocs('./openpkg.json')
569
- *
570
- * // Full HTML page
571
- * const html = docs.toHTML({ includeStyles: true })
572
- * fs.writeFileSync('api.html', html)
573
- *
574
- * // Single export, no document wrapper
575
- * const fragment = docs.toHTML({ export: 'greet', fullDocument: false })
576
- * ```
577
- */
578
- declare function toHTML2(spec: OpenPkg4, options?: HTMLOptions): string;
579
- import { OpenPkg as OpenPkg5, SpecExportKind as SpecExportKind2 } from "@openpkg-ts/spec";
580
- interface JSONOptions {
581
- /** Include raw spec data alongside simplified data */
582
- includeRaw?: boolean;
583
- /** Export to render (single mode) */
584
- export?: string;
585
- /** Include computed fields (signatures, formatted types) */
586
- computed?: boolean;
587
- /** Flatten nested structures */
588
- flatten?: boolean;
589
- }
590
- interface SimplifiedParameter {
591
- name: string;
592
- type: string;
593
- required: boolean;
594
- description?: string;
595
- default?: unknown;
596
- rest?: boolean;
597
- }
598
- interface SimplifiedReturn {
599
- type: string;
600
- description?: string;
601
- }
602
- interface SimplifiedSignature {
603
- parameters: SimplifiedParameter[];
604
- returns?: SimplifiedReturn;
605
- description?: string;
606
- typeParameters?: string[];
607
- }
608
- interface SimplifiedMember {
609
- name: string;
610
- kind: "property" | "method";
611
- type?: string;
612
- description?: string;
613
- visibility?: "public" | "protected" | "private";
614
- signature?: SimplifiedSignature;
615
- }
616
- interface SimplifiedExample {
617
- code: string;
618
- title?: string;
619
- description?: string;
620
- language?: string;
621
- }
622
- interface SimplifiedExport {
623
- id: string;
624
- name: string;
625
- kind: SpecExportKind2;
626
- signature: string;
627
- description?: string;
628
- deprecated: boolean;
629
- tags: Array<{
630
- name: string;
631
- text: string;
632
- }>;
633
- parameters?: SimplifiedParameter[];
634
- returns?: SimplifiedReturn;
635
- members?: SimplifiedMember[];
636
- examples?: SimplifiedExample[];
637
- extends?: string;
638
- implements?: string[];
639
- sourceFile?: string;
640
- sourceLine?: number;
641
- }
642
- interface SimplifiedSpec {
643
- name: string;
644
- version?: string;
645
- description?: string;
646
- exports: SimplifiedExport[];
647
- byKind: Record<SpecExportKind2, SimplifiedExport[]>;
648
- totalExports: number;
392
+ interface SearchIndex {
393
+ records: SearchRecord[];
394
+ version: string;
395
+ generatedAt: string;
396
+ packageName: string;
649
397
  }
650
398
  /**
651
- * Render spec to simplified JSON structure.
652
- *
653
- * @param spec - The OpenPkg spec to simplify
654
- * @param options - JSON rendering options
655
- * @returns Simplified spec or single structure
399
+ * Generate search index from spec.
656
400
  *
401
+ * @param spec - The OpenPkg spec to index
402
+ * @param options - Search index configuration
403
+ * @returns Search index with records for each *
657
404
  * @example
658
405
  * ```ts
659
406
  * import { createDocs } from '@openpkg-ts/sdk'
660
407
  *
661
408
  * const docs = createDocs('./openpkg.json')
409
+ * const index = docs.toSearchIndex({ baseUrl: '/api' })
410
+ * // { records: [...], version: '1.0.0', packageName: 'my-lib' }
411
+ * ```
412
+ */
413
+ declare function toSearchIndex2(spec: OpenPkg5, options?: SearchOptions): SearchIndex;
414
+ /**
415
+ * Generate Pagefind-compatible records.
662
416
  *
663
- * // Full spec as simplified JSON
664
- * const json = docs.toJSON()
665
- * // { name, version, exports: [...], byKind: {...} }
417
+ * @param spec - The OpenPkg spec to index
418
+ * @param options - Search configuration including weights
419
+ * @returns Array of Pagefind-compatible search records
666
420
  *
667
- * // Single * const fnJson = docs.toJSON({ export: 'greet' })
668
- * // { id, name, kind, signature, parameters, returns, ... }
421
+ * @example
422
+ * ```ts
423
+ * const records = toPagefindRecords(spec, {
424
+ * baseUrl: '/docs/api',
425
+ * weights: { name: 10, description: 5 }
426
+ * })
669
427
  * ```
670
428
  */
671
- declare function toJSON2(spec: OpenPkg5, options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
429
+ declare function toPagefindRecords2(spec: OpenPkg5, options?: SearchOptions): PagefindRecord[];
672
430
  /**
673
- * Serialize to JSON string with formatting.
431
+ * Generate Algolia-compatible records.
674
432
  *
675
- * @param spec - The OpenPkg spec to serialize
676
- * @param options - JSON options plus pretty formatting option
677
- * @returns JSON string
433
+ * @param spec - The OpenPkg spec to index
434
+ * @param options - Search configuration
435
+ * @returns Array of Algolia-compatible search records with hierarchy
436
+ *
437
+ * @example
438
+ * ```ts
439
+ * const records = toAlgoliaRecords(spec, { baseUrl: '/api' })
440
+ * // Upload to Algolia index
441
+ * ```
442
+ */
443
+ declare function toAlgoliaRecords2(spec: OpenPkg5, options?: SearchOptions): AlgoliaRecord[];
444
+ /**
445
+ * Serialize search index to JSON string.
446
+ *
447
+ * @param spec - The OpenPkg spec to index
448
+ * @param options - Search options plus pretty formatting option
449
+ * @returns JSON string of search index
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const json = toSearchIndexJSON(spec, { pretty: true })
454
+ * fs.writeFileSync('search-index.json', json)
455
+ * ```
678
456
  */
679
- declare function toJSONString(spec: OpenPkg5, options?: JSONOptions & {
457
+ declare function toSearchIndexJSON(spec: OpenPkg5, options?: SearchOptions & {
680
458
  pretty?: boolean;
681
459
  }): string;
682
- import { OpenPkg as OpenPkg6, SpecExport as SpecExport3 } from "@openpkg-ts/spec";
683
- interface MarkdownOptions {
684
- /** Include frontmatter in output */
685
- frontmatter?: boolean;
686
- /** Sections to include */
687
- sections?: {
688
- signature?: boolean;
689
- description?: boolean;
690
- parameters?: boolean;
691
- returns?: boolean;
692
- examples?: boolean;
693
- members?: boolean;
694
- properties?: boolean;
695
- methods?: boolean;
696
- };
697
- /** Custom frontmatter fields */
698
- customFrontmatter?: Record<string, unknown>;
699
- /** Use code fences for signatures */
700
- codeSignatures?: boolean;
701
- /** Heading level offset (0 = starts at h1, 1 = starts at h2) */
702
- headingOffset?: number;
460
+ interface LoadOptions {
461
+ /** Path to openpkg.json file or the spec object directly */
462
+ input: string | OpenPkg6;
703
463
  }
704
- interface ExportMarkdownOptions extends MarkdownOptions {
705
- /** Export to render */
706
- export?: string;
464
+ interface DocsInstance {
465
+ /** The parsed OpenPkg spec */
466
+ spec: OpenPkg6;
467
+ /** Get an by its ID */
468
+ getExport(id: string): SpecExport2 | undefined;
469
+ /** Get a type definition by its ID */
470
+ getType(id: string): SpecType | undefined;
471
+ /** Get all exports of a specific kind */
472
+ getExportsByKind(kind: SpecExportKind4): SpecExport2[];
473
+ /** Get all exports */
474
+ getAllExports(): SpecExport2[];
475
+ /** Get all type definitions */
476
+ getAllTypes(): SpecType[];
477
+ /** Get exports by JSDoc tag (e.g., '@beta', '@internal') */
478
+ getExportsByTag(tagName: string): SpecExport2[];
479
+ /** Search exports by name or description */
480
+ search(query: string): SpecExport2[];
481
+ /** Get exports belonging to a specific module/namespace */
482
+ getModule(moduleName: string): SpecExport2[];
483
+ /** Get deprecated exports */
484
+ getDeprecated(): SpecExport2[];
485
+ /** Get exports grouped by kind */
486
+ groupByKind(): Record<SpecExportKind4, SpecExport2[]>;
487
+ /** Render spec or single to MDX */
488
+ toMarkdown(options?: ExportMarkdownOptions): string;
489
+ /** Render spec or single to HTML */
490
+ toHTML(options?: HTMLOptions): string;
491
+ /** Render spec or single to JSON structure */
492
+ toJSON(options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
493
+ /** Generate navigation structure */
494
+ toNavigation(options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
495
+ /** Generate search index */
496
+ toSearchIndex(options?: SearchOptions): SearchIndex;
497
+ /** Generate Pagefind-compatible records */
498
+ toPagefindRecords(options?: SearchOptions): PagefindRecord[];
499
+ /** Generate Algolia-compatible records */
500
+ toAlgoliaRecords(options?: SearchOptions): AlgoliaRecord[];
707
501
  }
708
502
  /**
709
- * Render a single to MDX.
710
- *
711
- * @param exp - The to render
712
- * @param options - Markdown rendering options
713
- * @returns MDX string with frontmatter
503
+ * Loads an OpenPkg spec from file or object.
714
504
  *
715
505
  * @example
716
506
  * ```ts
717
- * const mdx = exportToMarkdown(fn, {
718
- * frontmatter: true,
719
- * codeSignatures: true,
720
- * sections: { examples: true }
721
- * })
507
+ * import { loadSpec } from '@openpkg-ts/sdk'
508
+ *
509
+ * // From spec object
510
+ * import spec from './openpkg.json'
511
+ * const docs = loadSpec(spec)
722
512
  * ```
723
513
  */
724
- declare function exportToMarkdown(exp: SpecExport3, options?: MarkdownOptions): string;
514
+ declare function loadSpec(spec: OpenPkg6): DocsInstance;
725
515
  /**
726
- * Render entire spec to MDX.
727
- *
728
- * @param spec - The OpenPkg spec to render
729
- * @param options - Markdown options, optionally with name for single mode
730
- * @returns MDX string
516
+ * Creates a docs instance for querying and rendering API documentation.
731
517
  *
732
518
  * @example
733
519
  * ```ts
734
520
  * import { createDocs } from '@openpkg-ts/sdk'
735
521
  *
522
+ * // From file path
736
523
  * const docs = createDocs('./openpkg.json')
737
524
  *
738
- * // Full spec
739
- * const fullMdx = docs.toMarkdown()
525
+ * // From spec object
526
+ * import spec from './openpkg.json'
527
+ * const docs = createDocs(spec)
740
528
  *
741
- * // Single * const fnMdx = docs.toMarkdown({ export: 'greet' })
529
+ * // Query
530
+ * docs.getExport('useState')
531
+ * docs.getExportsByKind('function')
532
+ * docs.getExportsByTag('@beta')
533
+ * docs.search('hook')
742
534
  * ```
743
535
  */
744
- declare function toMarkdown2(spec: OpenPkg6, options?: ExportMarkdownOptions): string;
745
- import { OpenPkg as OpenPkg7, SpecExportKind as SpecExportKind3 } from "@openpkg-ts/spec";
746
- type NavFormat = "fumadocs" | "docusaurus" | "generic";
747
- type GroupBy = "kind" | "module" | "tag" | "none";
748
- interface NavOptions {
749
- /** Output format */
750
- format?: NavFormat;
751
- /** How to group exports */
752
- groupBy?: GroupBy;
753
- /** Base path for links */
754
- basePath?: string;
755
- /** Custom slug generator */
756
- slugify?: (name: string) => string;
757
- /** Include index pages for groups */
758
- includeGroupIndex?: boolean;
759
- /** Custom kind labels */
760
- kindLabels?: Partial<Record<SpecExportKind3, string>>;
761
- /** Sort exports alphabetically */
762
- sortAlphabetically?: boolean;
763
- }
764
- interface NavItem {
765
- title: string;
766
- href?: string;
767
- items?: NavItem[];
768
- }
769
- interface NavGroup {
770
- title: string;
771
- items: NavItem[];
772
- index?: string;
773
- }
774
- interface GenericNav {
775
- title: string;
776
- groups: NavGroup[];
777
- items: NavItem[];
778
- }
779
- interface FumadocsMetaItem {
780
- title: string;
781
- pages?: string[];
782
- defaultOpen?: boolean;
783
- }
784
- interface FumadocsMeta {
785
- root?: boolean;
786
- title?: string;
787
- pages?: (string | FumadocsMetaItem)[];
788
- }
789
- interface DocusaurusSidebarItem {
790
- type: "category" | "doc" | "link";
791
- label: string;
792
- items?: DocusaurusSidebarItem[];
793
- id?: string;
794
- href?: string;
536
+ declare function createDocs(input: string | OpenPkg6): DocsInstance;
537
+ import { OpenPkg as OpenPkg7, SpecExport as SpecExport3, SpecMember as SpecMember2, SpecSchema, SpecSignature, SpecType as SpecType2, SpecTypeParameter } from "@openpkg-ts/spec";
538
+ interface FormatSchemaOptions {
539
+ /** Include package attribution for external types */
540
+ includePackage?: boolean;
795
541
  }
796
- type DocusaurusSidebar = DocusaurusSidebarItem[];
797
542
  /**
798
- * Generate navigation structure for doc frameworks.
543
+ * Format a schema to a human-readable type string.
544
+ *
545
+ * @param schema - The schema to format
546
+ * @param options - Formatting options
547
+ * @returns Formatted type string
548
+ *
549
+ * @example
550
+ * ```ts
551
+ * formatSchema({ type: 'string' }) // 'string'
552
+ * formatSchema({ $ref: '#/types/User' }) // 'User'
553
+ * formatSchema({ anyOf: [{ type: 'string' }, { type: 'number' }] }) // 'string | number'
554
+ * formatSchema({ type: 'integer', 'x-ts-type': 'bigint' }) // 'bigint'
555
+ * formatSchema({ 'x-ts-type': 'Response', 'x-ts-package': 'express' }, { includePackage: true }) // 'Response (from express)'
556
+ * ```
557
+ */
558
+ declare function formatSchema(schema: SpecSchema | undefined, options?: FormatSchemaOptions): string;
559
+ /**
560
+ * Format type parameters to a string like `<T, U extends string>`.
561
+ *
562
+ * @param typeParams - Array of type parameters
563
+ * @returns Formatted type parameters string or empty string
564
+ *
565
+ * @example
566
+ * ```ts
567
+ * formatTypeParameters([{ name: 'T' }]) // '<T>'
568
+ * formatTypeParameters([{ name: 'T', constraint: 'object' }]) // '<T extends object>'
569
+ * formatTypeParameters([{ name: 'T', default: 'unknown' }]) // '<T = unknown>'
570
+ * formatTypeParameters([{ name: 'T', variance: 'in' }]) // '<in T>'
571
+ * ```
572
+ */
573
+ declare function formatTypeParameters(typeParams?: SpecTypeParameter[]): string;
574
+ /**
575
+ * Format function parameters to a string like `(a: string, b?: number)`.
576
+ *
577
+ * @param sig - The signature containing parameters
578
+ * @returns Formatted parameters string
579
+ *
580
+ * @example
581
+ * ```ts
582
+ * formatParameters({ parameters: [{ name: 'id', schema: { type: 'string' } }] })
583
+ * // '(id: string)'
584
+ * ```
585
+ */
586
+ declare function formatParameters(sig?: SpecSignature): string;
587
+ /**
588
+ * Format return type from signature.
589
+ *
590
+ * @param sig - The signature containing return type
591
+ * @returns Formatted return type string
592
+ *
593
+ * @example
594
+ * ```ts
595
+ * formatReturnType({ returns: { schema: { type: 'Promise', items: { type: 'string' } } } })
596
+ * // 'Promise<string>'
597
+ * ```
598
+ */
599
+ declare function formatReturnType(sig?: SpecSignature): string;
600
+ /**
601
+ * Build a full signature string for an export.
799
602
  *
800
- * @param spec - The OpenPkg spec
801
- * @param options - Navigation options including format and grouping
802
- * @returns Navigation structure in requested format
603
+ * @param exp - The to build a signature for
604
+ * @param sigIndex - Index of signature to use for overloaded functions
605
+ * @returns Complete signature string
803
606
  *
804
607
  * @example
805
608
  * ```ts
806
- * import { createDocs } from '@openpkg-ts/sdk'
609
+ * buildSignatureString({ kind: 'function', name: 'greet', signatures: [...] })
610
+ * // 'function greet(name: string): string'
807
611
  *
808
- * const docs = createDocs('./openpkg.json')
612
+ * buildSignatureString({ kind: 'class', name: 'Logger', extends: 'EventEmitter' })
613
+ * // 'class Logger extends EventEmitter'
614
+ * ```
615
+ */
616
+ declare function buildSignatureString(exp: SpecExport3, sigIndex?: number): string;
617
+ /**
618
+ * Resolve a type reference to its definition.
809
619
  *
810
- * // Generic nav
811
- * const nav = docs.toNavigation({ format: 'generic', groupBy: 'kind' })
620
+ * @param ref - Type reference string (e.g., '#/types/User')
621
+ * @param spec - The OpenPkg spec containing type definitions
622
+ * @returns The resolved type definition or undefined
812
623
  *
813
- * // Fumadocs meta.json
814
- * const meta = docs.toNavigation({ format: 'fumadocs' })
624
+ * @example
625
+ * ```ts
626
+ * resolveTypeRef('#/types/User', spec)
627
+ * // { id: 'User', name: 'User', kind: 'interface', ... }
628
+ * ```
629
+ */
630
+ declare function resolveTypeRef(ref: string, spec: OpenPkg7): SpecType2 | undefined;
631
+ /**
632
+ * Check if a member is a method (has signatures).
815
633
  *
816
- * // Docusaurus sidebar
817
- * const sidebar = docs.toNavigation({ format: 'docusaurus' })
634
+ * @param member - The member to check
635
+ * @returns True if the member is a method
636
+ *
637
+ * @example
638
+ * ```ts
639
+ * isMethod({ name: 'foo', signatures: [{ parameters: [] }] }) // true
640
+ * isMethod({ name: 'bar', schema: { type: 'string' } }) // false
818
641
  * ```
819
642
  */
820
- declare function toNavigation2(spec: OpenPkg7, options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
643
+ declare function isMethod(member: SpecMember2): boolean;
821
644
  /**
822
- * Generate Fumadocs meta.json file content.
645
+ * Check if a member is a property (no signatures).
823
646
  *
824
- * @param spec - The OpenPkg spec
825
- * @param options - Navigation options (format is forced to fumadocs)
826
- * @returns JSON string for meta.json file
647
+ * @param member - The member to check
648
+ * @returns True if the member is a property
649
+ */
650
+ declare function isProperty(member: SpecMember2): boolean;
651
+ /**
652
+ * Get methods from members list.
653
+ *
654
+ * @param members - Array of members to filter
655
+ * @returns Array of method members
656
+ */
657
+ declare function getMethods(members?: SpecMember2[]): SpecMember2[];
658
+ /**
659
+ * Get properties from members list.
660
+ *
661
+ * @param members - Array of members to filter
662
+ * @returns Array of property members
663
+ */
664
+ declare function getProperties(members?: SpecMember2[]): SpecMember2[];
665
+ /**
666
+ * Group members by visibility (public, protected, private).
667
+ *
668
+ * @param members - Array of members to group
669
+ * @returns Object with public, protected, and private arrays
827
670
  *
828
671
  * @example
829
672
  * ```ts
830
- * const meta = toFumadocsMetaJSON(spec, { groupBy: 'kind' })
831
- * fs.writeFileSync('docs/api/meta.json', meta)
673
+ * const groups = groupByVisibility(classExport.members)
674
+ * groups.public // [{ name: 'foo', visibility: 'public' }]
675
+ * groups.private // [{ name: 'bar', visibility: 'private' }]
832
676
  * ```
833
677
  */
834
- declare function toFumadocsMetaJSON(spec: OpenPkg7, options?: Omit<NavOptions, "format">): string;
678
+ declare function groupByVisibility(members?: SpecMember2[]): {
679
+ public: SpecMember2[];
680
+ protected: SpecMember2[];
681
+ private: SpecMember2[];
682
+ };
835
683
  /**
836
- * Generate Docusaurus sidebar config.
684
+ * Sort exports alphabetically by name.
837
685
  *
838
- * @param spec - The OpenPkg spec
839
- * @param options - Navigation options (format is forced to docusaurus)
840
- * @returns JavaScript module.exports string for sidebars.js
686
+ * @param items - Array of items with a name property
687
+ * @returns New sorted array
688
+ */
689
+ declare function sortByName<T extends {
690
+ name: string;
691
+ }>(items: T[]): T[];
692
+ /**
693
+ * Conditional type structure from the spec.
694
+ */
695
+ interface SpecConditionalType {
696
+ checkType: SpecSchema;
697
+ extendsType: SpecSchema;
698
+ trueType: SpecSchema;
699
+ falseType: SpecSchema;
700
+ }
701
+ /**
702
+ * Mapped type structure from the spec.
703
+ */
704
+ interface SpecMappedType {
705
+ keyType: SpecSchema;
706
+ valueType: SpecSchema;
707
+ readonly?: boolean | "add" | "remove";
708
+ optional?: boolean | "add" | "remove";
709
+ }
710
+ /**
711
+ * Format a conditional type to a human-readable string.
712
+ *
713
+ * @param condType - The conditional type structure
714
+ * @returns Formatted conditional type string
841
715
  *
842
716
  * @example
843
717
  * ```ts
844
- * const sidebar = toDocusaurusSidebarJS(spec, { basePath: 'api' })
845
- * fs.writeFileSync('sidebars.js', sidebar)
718
+ * formatConditionalType({
719
+ * checkType: { 'x-ts-type': 'T' },
720
+ * extendsType: { type: 'string' },
721
+ * trueType: { type: 'boolean', const: true },
722
+ * falseType: { type: 'boolean', const: false }
723
+ * })
724
+ * // 'T extends string ? true : false'
846
725
  * ```
847
726
  */
848
- declare function toDocusaurusSidebarJS(spec: OpenPkg7, options?: Omit<NavOptions, "format">): string;
849
- interface LoadOptions {
850
- /** Path to openpkg.json file or the spec object directly */
851
- input: string | OpenPkg8;
727
+ declare function formatConditionalType(condType: SpecConditionalType): string;
728
+ /**
729
+ * Format a mapped type to a human-readable string.
730
+ *
731
+ * @param mappedType - The mapped type structure
732
+ * @returns Formatted mapped type string
733
+ *
734
+ * @example
735
+ * ```ts
736
+ * formatMappedType({
737
+ * keyType: { 'x-ts-type': 'K in keyof T' },
738
+ * valueType: { 'x-ts-type': 'T[K]' },
739
+ * readonly: true
740
+ * })
741
+ * // '{ readonly [K in keyof T]: T[K] }'
742
+ * ```
743
+ */
744
+ declare function formatMappedType(mappedType: SpecMappedType): string;
745
+ import { SpecExport as SpecExport4, SpecType as SpecType3 } from "@openpkg-ts/spec";
746
+ interface GetExportOptions {
747
+ /** Entry point file path */
748
+ entryFile: string;
749
+ /** Export name to get */
750
+ exportName: string;
751
+ /** Base directory for resolution */
752
+ baseDir?: string;
753
+ /** Optional in-memory content (for testing) */
754
+ content?: string;
755
+ /** Max depth for type resolution */
756
+ maxTypeDepth?: number;
757
+ }
758
+ interface GetExportResult {
759
+ /** The spec, or null if not found */
760
+ export: SpecExport4 | null;
761
+ /** Related types referenced by the */
762
+ types: SpecType3[];
763
+ /** Errors encountered */
764
+ errors: string[];
765
+ }
766
+ /**
767
+ * Get detailed spec for a single */
768
+ declare function getExport2(options: GetExportOptions): Promise<GetExportResult>;
769
+ interface ListExportsOptions {
770
+ /** Entry point file path */
771
+ entryFile: string;
772
+ /** Base directory for resolution */
773
+ baseDir?: string;
774
+ /** Optional in-memory content (for testing) */
775
+ content?: string;
776
+ }
777
+ interface ExportItem {
778
+ /** Export name */
779
+ name: string;
780
+ /** Export kind */
781
+ kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "namespace";
782
+ /** Source file path */
783
+ file: string;
784
+ /** Line number (1-indexed) */
785
+ line: number;
786
+ /** JSDoc description (first line, max 80 chars) */
787
+ description?: string;
788
+ /** Whether is deprecated */
789
+ deprecated?: boolean;
790
+ /** Whether this is a re-from another module */
791
+ reexport?: boolean;
792
+ }
793
+ interface ListExportsResult {
794
+ exports: ExportItem[];
795
+ errors: string[];
796
+ }
797
+ /**
798
+ * List all exports from a TypeScript entry point
799
+ */
800
+ declare function listExports(options: ListExportsOptions): Promise<ListExportsResult>;
801
+ import { OpenPkg as OpenPkg8 } from "@openpkg-ts/spec";
802
+ interface ExtractOptions {
803
+ entryFile: string;
804
+ baseDir?: string;
805
+ content?: string;
806
+ maxTypeDepth?: number;
807
+ maxExternalTypeDepth?: number;
808
+ resolveExternalTypes?: boolean;
809
+ schemaExtraction?: "static" | "hybrid";
810
+ /** Target JSON Schema dialect for runtime schema extraction */
811
+ schemaTarget?: "draft-2020-12" | "draft-07" | "openapi-3.0";
812
+ /** Include $schema URL in output */
813
+ includeSchema?: boolean;
814
+ /** Only extract these exports (supports * wildcards) */
815
+ only?: string[];
816
+ /** Ignore these exports (supports * wildcards) */
817
+ ignore?: string[];
818
+ /** Progress callback for tracking extraction progress */
819
+ onProgress?: (current: number, total: number, item: string) => void;
820
+ /** Whether source is a .d.ts file (degraded mode - TSDoc may be missing) */
821
+ isDtsSource?: boolean;
822
+ }
823
+ interface ExtractResult {
824
+ spec: OpenPkg8;
825
+ diagnostics: Diagnostic[];
826
+ forgottenExports?: ForgottenExport[];
827
+ /** Metadata about runtime schema extraction (when schemaExtraction: 'hybrid') */
828
+ runtimeSchemas?: {
829
+ /** Number of schema exports found */
830
+ extracted: number;
831
+ /** Number of schemas successfully merged with static types */
832
+ merged: number;
833
+ /** Schema vendors detected (e.g., 'zod', 'arktype', 'valibot', 'typebox') */
834
+ vendors: string[];
835
+ /** Any errors encountered during runtime extraction */
836
+ errors: string[];
837
+ /** Extraction method used: 'compiled' or 'direct-ts (runtime)' */
838
+ method?: string;
839
+ };
840
+ /** Degraded mode info when extracting from .d.ts files */
841
+ degradedMode?: {
842
+ reason: "dts-source";
843
+ stats: {
844
+ exportsWithoutDescription: number;
845
+ paramsWithoutDocs: number;
846
+ missingExamples: number;
847
+ };
848
+ };
849
+ /** Export verification comparing discovered vs extracted */
850
+ verification?: ExportVerification;
851
+ }
852
+ interface Diagnostic {
853
+ message: string;
854
+ severity: "error" | "warning" | "info";
855
+ code?: string;
856
+ suggestion?: string;
857
+ location?: {
858
+ file?: string;
859
+ line?: number;
860
+ column?: number;
861
+ };
862
+ }
863
+ /** Context tracking for type references in public API */
864
+ interface TypeReference2 {
865
+ typeName: string;
866
+ exportName: string;
867
+ location: "return" | "parameter" | "property" | "extends" | "type-parameter";
868
+ path?: string;
852
869
  }
853
- interface DocsInstance {
854
- /** The parsed OpenPkg spec */
855
- spec: OpenPkg8;
856
- /** Get an by its ID */
857
- getExport(id: string): SpecExport4 | undefined;
858
- /** Get a type definition by its ID */
859
- getType(id: string): SpecType3 | undefined;
860
- /** Get all exports of a specific kind */
861
- getExportsByKind(kind: SpecExportKind4): SpecExport4[];
862
- /** Get all exports */
863
- getAllExports(): SpecExport4[];
864
- /** Get all type definitions */
865
- getAllTypes(): SpecType3[];
866
- /** Get exports by JSDoc tag (e.g., '@beta', '@internal') */
867
- getExportsByTag(tagName: string): SpecExport4[];
868
- /** Search exports by name or description */
869
- search(query: string): SpecExport4[];
870
- /** Get exports belonging to a specific module/namespace */
871
- getModule(moduleName: string): SpecExport4[];
872
- /** Get deprecated exports */
873
- getDeprecated(): SpecExport4[];
874
- /** Get exports grouped by kind */
875
- groupByKind(): Record<SpecExportKind4, SpecExport4[]>;
876
- /** Render spec or single to MDX */
877
- toMarkdown(options?: ExportMarkdownOptions): string;
878
- /** Render spec or single to HTML */
879
- toHTML(options?: HTMLOptions): string;
880
- /** Render spec or single to JSON structure */
881
- toJSON(options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
882
- /** Generate navigation structure */
883
- toNavigation(options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
884
- /** Generate search index */
885
- toSearchIndex(options?: SearchOptions): SearchIndex;
886
- /** Generate Pagefind-compatible records */
887
- toPagefindRecords(options?: SearchOptions): PagefindRecord[];
888
- /** Generate Algolia-compatible records */
889
- toAlgoliaRecords(options?: SearchOptions): AlgoliaRecord[];
870
+ /** Structured data for forgotten exports */
871
+ interface ForgottenExport {
872
+ name: string;
873
+ definedIn?: string;
874
+ referencedBy: TypeReference2[];
875
+ isExternal: boolean;
876
+ fix?: string;
877
+ }
878
+ /** Tracks status of each discovered through serialization pipeline */
879
+ interface ExportTracker {
880
+ name: string;
881
+ discovered: boolean;
882
+ status: "pending" | "success" | "skipped" | "failed";
883
+ skipReason?: "filtered" | "no-declaration" | "internal";
884
+ error?: string;
885
+ kind?: string;
886
+ }
887
+ /** Verification result comparing discovered vs extracted exports */
888
+ interface ExportVerification {
889
+ /** Total exports discovered by TypeScript */
890
+ discovered: number;
891
+ /** Exports successfully extracted */
892
+ extracted: number;
893
+ /** Exports skipped (filtered, no-declaration, internal) */
894
+ skipped: number;
895
+ /** Exports that failed during serialization */
896
+ failed: number;
897
+ /** Delta: discovered - extracted */
898
+ delta: number;
899
+ details: {
900
+ skipped: Array<{
901
+ name: string;
902
+ reason: "filtered" | "no-declaration" | "internal";
903
+ }>;
904
+ failed: Array<{
905
+ name: string;
906
+ error: string;
907
+ }>;
908
+ };
890
909
  }
891
910
  /**
892
- * Loads an OpenPkg spec from file or object.
893
- *
894
- * @example
895
- * ```ts
896
- * import { loadSpec } from '@openpkg-ts/sdk'
897
- *
898
- * // From spec object
899
- * import spec from './openpkg.json'
900
- * const docs = loadSpec(spec)
901
- * ```
902
- */
903
- declare function loadSpec(spec: OpenPkg8): DocsInstance;
904
- /**
905
- * Creates a docs instance for querying and rendering API documentation.
911
+ * Extract full OpenPkg spec from a TypeScript entry point
906
912
  *
907
913
  * @example
908
- * ```ts
909
- * import { createDocs } from '@openpkg-ts/sdk'
910
- *
911
- * // From file path
912
- * const docs = createDocs('./openpkg.json')
914
+ * ```typescript
915
+ * import { extractSpec } from '@openpkg-ts/sdk';
913
916
  *
914
- * // From spec object
915
- * import spec from './openpkg.json'
916
- * const docs = createDocs(spec)
917
+ * const result = await extractSpec({
918
+ * entryFile: './src/index.ts'
919
+ * });
917
920
  *
918
- * // Query
919
- * docs.getExport('useState')
920
- * docs.getExportsByKind('function')
921
- * docs.getExportsByTag('@beta')
922
- * docs.search('hook')
921
+ * console.log(result.spec.exports.length);
923
922
  * ```
924
923
  */
925
- declare function createDocs(input: string | OpenPkg8): DocsInstance;
924
+ declare const extractSpec: (options: ExtractOptions) => Promise<ExtractResult>;
926
925
  import { SpecType as SpecType4 } from "@openpkg-ts/spec";
927
926
  import ts2 from "typescript";
928
927
  import ts from "typescript";
@@ -1005,75 +1004,6 @@ declare function extractTypeParameters(node: DeclarationWithTypeParams, checker:
1005
1004
  * Check if a symbol is marked as deprecated via @deprecated JSDoc tag.
1006
1005
  */
1007
1006
  declare function isSymbolDeprecated(symbol: ts4.Symbol | undefined): boolean;
1008
- import ts5 from "typescript";
1009
- interface ProgramOptions {
1010
- entryFile: string;
1011
- baseDir?: string;
1012
- content?: string;
1013
- }
1014
- interface ProgramResult {
1015
- program: ts5.Program;
1016
- compilerHost: ts5.CompilerHost;
1017
- compilerOptions: ts5.CompilerOptions;
1018
- sourceFile?: ts5.SourceFile;
1019
- configPath?: string;
1020
- /** Resolved project references (workspace packages) */
1021
- projectReferences?: ts5.ResolvedProjectReference[];
1022
- }
1023
- declare function createProgram({ entryFile, baseDir, content }: ProgramOptions): ProgramResult;
1024
- import * as TS from "typescript";
1025
- /**
1026
- * A schema adapter can detect and extract output types from a specific
1027
- * schema validation library.
1028
- */
1029
- interface SchemaAdapter {
1030
- /** Unique identifier for this adapter */
1031
- readonly id: string;
1032
- /** npm package name(s) this adapter handles */
1033
- readonly packages: readonly string[];
1034
- /**
1035
- * Check if a type matches this adapter's schema library.
1036
- * Should be fast - called for every export.
1037
- */
1038
- matches(type: TS.Type, checker: TS.TypeChecker): boolean;
1039
- /**
1040
- * Extract the output type from a schema type.
1041
- * Returns null if extraction fails.
1042
- */
1043
- extractOutputType(type: TS.Type, checker: TS.TypeChecker): TS.Type | null;
1044
- /**
1045
- * Extract the input type from a schema type (optional).
1046
- * Useful for transforms where input differs from output.
1047
- */
1048
- extractInputType?(type: TS.Type, checker: TS.TypeChecker): TS.Type | null;
1049
- }
1050
- /**
1051
- * Result of schema type extraction
1052
- */
1053
- interface SchemaExtractionResult {
1054
- /** The adapter that matched */
1055
- adapter: SchemaAdapter;
1056
- /** The extracted output type */
1057
- outputType: TS.Type;
1058
- /** The extracted input type (if different from output) */
1059
- inputType?: TS.Type;
1060
- }
1061
- /**
1062
- * Utility: Check if type is an object type reference (has type arguments)
1063
- */
1064
- declare function isTypeReference(type: TS.Type): type is TS.TypeReference;
1065
- /**
1066
- * Utility: Remove undefined/null from a union type
1067
- */
1068
- declare function getNonNullableType(type: TS.Type): TS.Type;
1069
- declare function registerAdapter(adapter: SchemaAdapter): void;
1070
- declare function findAdapter(type: TS.Type, checker: TS.TypeChecker): SchemaAdapter | undefined;
1071
- declare function isSchemaType(type: TS.Type, checker: TS.TypeChecker): boolean;
1072
- declare function extractSchemaType(type: TS.Type, checker: TS.TypeChecker): SchemaExtractionResult | null;
1073
- declare const arktypeAdapter: SchemaAdapter;
1074
- declare const typeboxAdapter: SchemaAdapter;
1075
- declare const valibotAdapter: SchemaAdapter;
1076
- declare const zodAdapter: SchemaAdapter;
1077
1007
  /**
1078
1008
  * Target version for JSON Schema generation.
1079
1009
  * @see https://standardschema.dev/json-schema
@@ -1227,24 +1157,94 @@ interface ProjectExtractionOutput extends StandardSchemaExtractionOutput {
1227
1157
  * @param options - Extraction options
1228
1158
  */
1229
1159
  declare function extractStandardSchemasFromProject(entryFile: string, baseDir: string, options?: ExtractFromProjectOptions): Promise<ProjectExtractionOutput>;
1230
- import { SpecExport as SpecExport5 } from "@openpkg-ts/spec";
1231
- import ts6 from "typescript";
1232
- declare function serializeClass(node: ts6.ClassDeclaration, ctx: SerializerContext): SpecExport5 | null;
1160
+ declare function extract(options: ExtractOptions): Promise<ExtractResult>;
1161
+ import ts5 from "typescript";
1162
+ interface ProgramOptions {
1163
+ entryFile: string;
1164
+ baseDir?: string;
1165
+ content?: string;
1166
+ }
1167
+ interface ProgramResult {
1168
+ program: ts5.Program;
1169
+ compilerHost: ts5.CompilerHost;
1170
+ compilerOptions: ts5.CompilerOptions;
1171
+ sourceFile?: ts5.SourceFile;
1172
+ configPath?: string;
1173
+ /** Resolved project references (workspace packages) */
1174
+ projectReferences?: ts5.ResolvedProjectReference[];
1175
+ }
1176
+ declare function createProgram({ entryFile, baseDir, content }: ProgramOptions): ProgramResult;
1177
+ import * as TS from "typescript";
1178
+ /**
1179
+ * A schema adapter can detect and extract output types from a specific
1180
+ * schema validation library.
1181
+ */
1182
+ interface SchemaAdapter {
1183
+ /** Unique identifier for this adapter */
1184
+ readonly id: string;
1185
+ /** npm package name(s) this adapter handles */
1186
+ readonly packages: readonly string[];
1187
+ /**
1188
+ * Check if a type matches this adapter's schema library.
1189
+ * Should be fast - called for every export.
1190
+ */
1191
+ matches(type: TS.Type, checker: TS.TypeChecker): boolean;
1192
+ /**
1193
+ * Extract the output type from a schema type.
1194
+ * Returns null if extraction fails.
1195
+ */
1196
+ extractOutputType(type: TS.Type, checker: TS.TypeChecker): TS.Type | null;
1197
+ /**
1198
+ * Extract the input type from a schema type (optional).
1199
+ * Useful for transforms where input differs from output.
1200
+ */
1201
+ extractInputType?(type: TS.Type, checker: TS.TypeChecker): TS.Type | null;
1202
+ }
1203
+ /**
1204
+ * Result of schema type extraction
1205
+ */
1206
+ interface SchemaExtractionResult {
1207
+ /** The adapter that matched */
1208
+ adapter: SchemaAdapter;
1209
+ /** The extracted output type */
1210
+ outputType: TS.Type;
1211
+ /** The extracted input type (if different from output) */
1212
+ inputType?: TS.Type;
1213
+ }
1214
+ /**
1215
+ * Utility: Check if type is an object type reference (has type arguments)
1216
+ */
1217
+ declare function isTypeReference(type: TS.Type): type is TS.TypeReference;
1218
+ /**
1219
+ * Utility: Remove undefined/null from a union type
1220
+ */
1221
+ declare function getNonNullableType(type: TS.Type): TS.Type;
1222
+ declare function registerAdapter(adapter: SchemaAdapter): void;
1223
+ declare function findAdapter(type: TS.Type, checker: TS.TypeChecker): SchemaAdapter | undefined;
1224
+ declare function isSchemaType(type: TS.Type, checker: TS.TypeChecker): boolean;
1225
+ declare function extractSchemaType(type: TS.Type, checker: TS.TypeChecker): SchemaExtractionResult | null;
1226
+ declare const arktypeAdapter: SchemaAdapter;
1227
+ declare const typeboxAdapter: SchemaAdapter;
1228
+ declare const valibotAdapter: SchemaAdapter;
1229
+ declare const zodAdapter: SchemaAdapter;
1233
1230
  import { SpecExport as SpecExport6 } from "@openpkg-ts/spec";
1234
- import ts7 from "typescript";
1235
- declare function serializeEnum(node: ts7.EnumDeclaration, ctx: SerializerContext): SpecExport6 | null;
1231
+ import ts6 from "typescript";
1232
+ declare function serializeClass(node: ts6.ClassDeclaration, ctx: SerializerContext): SpecExport6 | null;
1236
1233
  import { SpecExport as SpecExport7 } from "@openpkg-ts/spec";
1237
- import ts8 from "typescript";
1238
- declare function serializeFunctionExport(node: ts8.FunctionDeclaration | ts8.ArrowFunction, ctx: SerializerContext): SpecExport7 | null;
1234
+ import ts7 from "typescript";
1235
+ declare function serializeEnum(node: ts7.EnumDeclaration, ctx: SerializerContext): SpecExport7 | null;
1239
1236
  import { SpecExport as SpecExport8 } from "@openpkg-ts/spec";
1240
- import ts9 from "typescript";
1241
- declare function serializeInterface(node: ts9.InterfaceDeclaration, ctx: SerializerContext): SpecExport8 | null;
1237
+ import ts8 from "typescript";
1238
+ declare function serializeFunctionExport(node: ts8.FunctionDeclaration | ts8.ArrowFunction, ctx: SerializerContext): SpecExport8 | null;
1242
1239
  import { SpecExport as SpecExport9 } from "@openpkg-ts/spec";
1243
- import ts10 from "typescript";
1244
- declare function serializeTypeAlias(node: ts10.TypeAliasDeclaration, ctx: SerializerContext): SpecExport9 | null;
1240
+ import ts9 from "typescript";
1241
+ declare function serializeInterface(node: ts9.InterfaceDeclaration, ctx: SerializerContext): SpecExport9 | null;
1245
1242
  import { SpecExport as SpecExport10 } from "@openpkg-ts/spec";
1243
+ import ts10 from "typescript";
1244
+ declare function serializeTypeAlias(node: ts10.TypeAliasDeclaration, ctx: SerializerContext): SpecExport10 | null;
1245
+ import { SpecExport as SpecExport11 } from "@openpkg-ts/spec";
1246
1246
  import ts11 from "typescript";
1247
- declare function serializeVariable(node: ts11.VariableDeclaration, statement: ts11.VariableStatement, ctx: SerializerContext): SpecExport10 | null;
1247
+ declare function serializeVariable(node: ts11.VariableDeclaration, statement: ts11.VariableStatement, ctx: SerializerContext): SpecExport11 | null;
1248
1248
  import { SpecSignatureParameter } from "@openpkg-ts/spec";
1249
1249
  import ts12 from "typescript";
1250
1250
  declare function extractParameters(signature: ts12.Signature, ctx: SerializerContext): SpecSignatureParameter[];
@@ -1321,7 +1321,7 @@ declare function deduplicateSchemas(schemas: SpecSchema2[]): SpecSchema2[];
1321
1321
  * A valid discriminator has a unique literal value in each union member.
1322
1322
  */
1323
1323
  declare function findDiscriminatorProperty(unionTypes: ts13.Type[], checker: ts13.TypeChecker): string | undefined;
1324
- import { SpecExport as SpecExport11, SpecMember as SpecMember3, SpecSchema as SpecSchema3, SpecType as SpecType5 } from "@openpkg-ts/spec";
1324
+ import { SpecExport as SpecExport12, SpecMember as SpecMember3, SpecSchema as SpecSchema3, SpecType as SpecType5 } from "@openpkg-ts/spec";
1325
1325
  /**
1326
1326
  * Options for schema normalization
1327
1327
  */
@@ -1352,7 +1352,7 @@ declare function normalizeSchema(schema: SpecSchema3, options?: NormalizeOptions
1352
1352
  * 2. Normalize member schemas
1353
1353
  * 3. Generate a JSON Schema from members if members exist (populates `schema` field)
1354
1354
  */
1355
- declare function normalizeExport(exp: SpecExport11, options?: NormalizeOptions): SpecExport11;
1355
+ declare function normalizeExport(exp: SpecExport12, options?: NormalizeOptions): SpecExport12;
1356
1356
  /**
1357
1357
  * Normalize a SpecType, normalizing its schema and nested schemas.
1358
1358
  *
@@ -1386,5 +1386,4 @@ declare function normalizeMembers(members: SpecMember3[], options?: NormalizeOpt
1386
1386
  import ts14 from "typescript";
1387
1387
  declare function isExported(node: ts14.Node): boolean;
1388
1388
  declare function getNodeName(node: ts14.Node): string | undefined;
1389
- declare function extract(options: ExtractOptions): Promise<ExtractResult>;
1390
1389
  export { zodAdapter, withDescription, valibotAdapter, typeboxAdapter, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, sortByName, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, registerReferencedTypes, registerAdapter, recommendSemverBump, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, loadSpec, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinGeneric, isAnonymous, groupByVisibility, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExport2 as getExport, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findDiscriminatorProperty, findAdapter, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, buildSignatureString, buildSchema, arktypeAdapter, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecDiff, SpecConditionalType, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaExtractionResult, SchemaAdapter, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, Diagnostic, CategorizedBreaking, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };