@bfra.me/doc-sync 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.
Files changed (50) hide show
  1. package/README.md +288 -0
  2. package/lib/chunk-6NKAJT2M.js +1233 -0
  3. package/lib/chunk-DR6UG237.js +1027 -0
  4. package/lib/chunk-G5KKGJYO.js +1560 -0
  5. package/lib/chunk-ROLA7SBB.js +12 -0
  6. package/lib/cli/index.d.ts +1 -0
  7. package/lib/cli/index.js +397 -0
  8. package/lib/generators/index.d.ts +170 -0
  9. package/lib/generators/index.js +76 -0
  10. package/lib/index.d.ts +141 -0
  11. package/lib/index.js +118 -0
  12. package/lib/parsers/index.d.ts +264 -0
  13. package/lib/parsers/index.js +113 -0
  14. package/lib/types.d.ts +388 -0
  15. package/lib/types.js +7 -0
  16. package/package.json +99 -0
  17. package/src/cli/commands/index.ts +3 -0
  18. package/src/cli/commands/sync.ts +146 -0
  19. package/src/cli/commands/validate.ts +151 -0
  20. package/src/cli/commands/watch.ts +74 -0
  21. package/src/cli/index.ts +71 -0
  22. package/src/cli/types.ts +19 -0
  23. package/src/cli/ui.ts +123 -0
  24. package/src/generators/api-reference-generator.ts +268 -0
  25. package/src/generators/code-example-formatter.ts +313 -0
  26. package/src/generators/component-mapper.ts +383 -0
  27. package/src/generators/content-merger.ts +295 -0
  28. package/src/generators/frontmatter-generator.ts +277 -0
  29. package/src/generators/index.ts +56 -0
  30. package/src/generators/mdx-generator.ts +289 -0
  31. package/src/index.ts +131 -0
  32. package/src/orchestrator/index.ts +21 -0
  33. package/src/orchestrator/package-scanner.ts +276 -0
  34. package/src/orchestrator/sync-orchestrator.ts +382 -0
  35. package/src/orchestrator/validation-pipeline.ts +328 -0
  36. package/src/parsers/export-analyzer.ts +335 -0
  37. package/src/parsers/guards.ts +350 -0
  38. package/src/parsers/index.ts +82 -0
  39. package/src/parsers/jsdoc-extractor.ts +313 -0
  40. package/src/parsers/package-info.ts +267 -0
  41. package/src/parsers/readme-parser.ts +334 -0
  42. package/src/parsers/typescript-parser.ts +299 -0
  43. package/src/types.ts +423 -0
  44. package/src/utils/index.ts +13 -0
  45. package/src/utils/safe-patterns.ts +280 -0
  46. package/src/utils/sanitization.ts +164 -0
  47. package/src/watcher/change-detector.ts +138 -0
  48. package/src/watcher/debouncer.ts +168 -0
  49. package/src/watcher/file-watcher.ts +164 -0
  50. package/src/watcher/index.ts +27 -0
package/lib/index.d.ts ADDED
@@ -0,0 +1,141 @@
1
+ export { CodeExampleOptions, ComponentMapperConfig, ContentSection, MDXGeneratorOptions, MergeOptions, MergeResult, SectionMapper, cleanCodeExample, createBadge, createCard, createCardGrid, createDiffSummary, createTabs, detectLanguage, extractAutoSections, extractManualSections, formatCodeBlock, formatCodeExamples, formatFunctionExamples, formatGroupedExamples, formatTypeExamples, formatUsageExample, generateAPICompact, generateAPIReference, generateCategoryReference, generateFrontmatter, generateInstallTabs, generateMDXDocument, groupExamplesByCategory, hasAutoContent, hasManualContent, mapToStarlightComponents, mergeContent, parseFrontmatter, sanitizeContent, sanitizeTextContent, stringifyFrontmatter, stripSentinelMarkers, validateMDXSyntax, validateMarkerPairing, wrapAutoSection, wrapManualSection } from './generators/index.js';
2
+ import { Result } from '@bfra.me/es/result';
3
+ import { PackageInfo, ReadmeContent, PackageAPI, SyncError, FileChangeEvent, DocConfig, SyncSummary, MDXDocument } from './types.js';
4
+ export { CLIOptions, DocConfigSource, ExportedFunction, ExportedType, FunctionParameter, InferSchema, JSDocInfo, JSDocParam, JSDocTag, MDXFrontmatter, ParseError, ParseErrorCode, ParseResult, ReExport, ReadmeSection, SENTINEL_MARKERS, SyncErrorCode, SyncInfo, SyncResult } from './types.js';
5
+ import 'zod';
6
+
7
+ interface PackageScannerOptions {
8
+ readonly rootDir: string;
9
+ readonly includePatterns?: readonly string[];
10
+ readonly excludePackages?: readonly string[];
11
+ readonly parseSourceFiles?: boolean;
12
+ readonly parseReadme?: boolean;
13
+ }
14
+ interface ScannedPackage {
15
+ readonly info: PackageInfo;
16
+ readonly readme?: ReadmeContent;
17
+ readonly api?: PackageAPI;
18
+ readonly sourceFiles: readonly string[];
19
+ readonly needsDocumentation: boolean;
20
+ readonly existingDocPath?: string;
21
+ }
22
+ interface ScanResult {
23
+ readonly packages: readonly ScannedPackage[];
24
+ readonly packagesNeedingDocs: readonly ScannedPackage[];
25
+ readonly errors: readonly SyncError[];
26
+ readonly durationMs: number;
27
+ }
28
+ declare function createPackageScanner(options: PackageScannerOptions): {
29
+ readonly scan: () => Promise<ScanResult>;
30
+ readonly scanPackage: (packagePath: string) => Promise<Result<ScannedPackage, SyncError>>;
31
+ };
32
+ declare function filterPackagesByPattern(packages: readonly ScannedPackage[], pattern: string): ScannedPackage[];
33
+ declare function groupPackagesByScope(packages: readonly ScannedPackage[]): Map<string, ScannedPackage[]>;
34
+
35
+ interface DocWatcherOptions {
36
+ readonly rootDir?: string;
37
+ readonly debounceMs?: number;
38
+ readonly additionalIgnore?: readonly string[];
39
+ readonly usePolling?: boolean;
40
+ }
41
+ type DocChangeHandler = (events: readonly FileChangeEvent[]) => void | Promise<void>;
42
+ interface DocFileWatcher {
43
+ readonly start: () => Promise<void>;
44
+ readonly close: () => Promise<void>;
45
+ readonly onChanges: (handler: DocChangeHandler) => () => void;
46
+ readonly getWatchedPaths: () => readonly string[];
47
+ }
48
+ declare function createDocWatcher(options?: DocWatcherOptions): DocFileWatcher;
49
+ type FileCategory = 'readme' | 'source' | 'package-json' | 'unknown';
50
+ declare function categorizeFile(filePath: string): FileCategory;
51
+ declare function groupChangesByPackage(events: readonly FileChangeEvent[]): Map<string, FileChangeEvent[]>;
52
+ declare function filterDocumentationChanges(events: readonly FileChangeEvent[]): FileChangeEvent[];
53
+
54
+ interface DocChangeDetectorOptions {
55
+ readonly algorithm?: 'sha256' | 'md5';
56
+ }
57
+ interface PackageChangeAnalysis {
58
+ readonly packageName: string;
59
+ readonly needsRegeneration: boolean;
60
+ readonly changedCategories: readonly FileCategory[];
61
+ readonly changedFiles: readonly string[];
62
+ }
63
+ interface DocChangeDetector {
64
+ readonly hasChanged: (filePath: string) => Promise<boolean>;
65
+ readonly record: (filePath: string) => Promise<void>;
66
+ readonly recordPackage: (pkg: PackageInfo, files: readonly string[]) => Promise<void>;
67
+ readonly clear: (filePath: string) => void;
68
+ readonly clearAll: () => void;
69
+ readonly analyzeChanges: (events: readonly FileChangeEvent[]) => Promise<PackageChangeAnalysis[]>;
70
+ }
71
+ declare function createDocChangeDetector(options?: DocChangeDetectorOptions): DocChangeDetector;
72
+ type RegenerationScope = 'full' | 'api-only' | 'readme-only' | 'metadata-only' | 'none';
73
+ declare function determineRegenerationScope(changedCategories: readonly FileCategory[]): RegenerationScope;
74
+ declare function hasAnyFileChanged(detector: DocChangeDetector, files: readonly string[]): Promise<boolean>;
75
+
76
+ interface DocDebouncerOptions {
77
+ readonly debounceMs?: number;
78
+ readonly maxWaitMs?: number;
79
+ }
80
+ type BatchChangeHandler = (events: readonly FileChangeEvent[]) => void | Promise<void>;
81
+ interface DocDebouncer {
82
+ readonly add: (event: FileChangeEvent) => void;
83
+ readonly addAll: (events: readonly FileChangeEvent[]) => void;
84
+ readonly flush: () => void;
85
+ readonly cancel: () => void;
86
+ readonly getPendingCount: () => number;
87
+ }
88
+ declare function createDocDebouncer(handler: BatchChangeHandler, options?: DocDebouncerOptions): DocDebouncer;
89
+ declare function deduplicateEvents(events: readonly FileChangeEvent[]): FileChangeEvent[];
90
+ declare function consolidateEvents(events: readonly FileChangeEvent[]): FileChangeEvent[];
91
+
92
+ interface SyncOrchestratorOptions {
93
+ readonly config: DocConfig;
94
+ readonly dryRun?: boolean;
95
+ readonly verbose?: boolean;
96
+ readonly onProgress?: (message: string) => void;
97
+ readonly onError?: (error: SyncError) => void;
98
+ }
99
+ interface SyncOrchestrator {
100
+ readonly syncAll: () => Promise<SyncSummary>;
101
+ readonly syncPackages: (packageNames: readonly string[]) => Promise<SyncSummary>;
102
+ readonly handleChanges: (events: readonly FileChangeEvent[]) => Promise<SyncSummary>;
103
+ readonly startWatching: () => Promise<void>;
104
+ readonly stopWatching: () => Promise<void>;
105
+ readonly isWatching: () => boolean;
106
+ }
107
+ declare function createSyncOrchestrator(options: SyncOrchestratorOptions): SyncOrchestrator;
108
+ /** Prevents directory traversal attacks (SEC-002) */
109
+ declare function isValidFilePath(filePath: string, rootDir: string): boolean;
110
+
111
+ interface ValidationResult {
112
+ readonly valid: boolean;
113
+ readonly errors: readonly ValidationError[];
114
+ readonly warnings: readonly ValidationWarning[];
115
+ }
116
+ interface ValidationError {
117
+ readonly type: 'syntax' | 'frontmatter' | 'component' | 'content';
118
+ readonly message: string;
119
+ readonly line?: number;
120
+ readonly column?: number;
121
+ }
122
+ interface ValidationWarning {
123
+ readonly type: 'deprecation' | 'recommendation' | 'compatibility';
124
+ readonly message: string;
125
+ readonly line?: number;
126
+ }
127
+ interface ValidationPipelineOptions {
128
+ readonly validateFrontmatter?: boolean;
129
+ readonly validateComponents?: boolean;
130
+ readonly validateContent?: boolean;
131
+ readonly strict?: boolean;
132
+ }
133
+ declare function createValidationPipeline(options?: ValidationPipelineOptions): {
134
+ readonly validate: (doc: MDXDocument) => ValidationResult;
135
+ readonly validateContent: (content: string) => ValidationResult;
136
+ readonly validateMultiple: (docs: readonly MDXDocument[]) => Result<Map<string, ValidationResult>, SyncError>;
137
+ };
138
+ declare function validateDocument(doc: MDXDocument, options?: ValidationPipelineOptions): Result<MDXDocument, SyncError>;
139
+ declare function validateContentString(content: string, options?: ValidationPipelineOptions): Result<string, SyncError>;
140
+
141
+ export { type BatchChangeHandler, type DocChangeDetector, type DocChangeDetectorOptions, type DocChangeHandler, DocConfig, type DocDebouncer, type DocDebouncerOptions, type DocFileWatcher, type DocWatcherOptions, type FileCategory, FileChangeEvent, MDXDocument, PackageAPI, type PackageChangeAnalysis, PackageInfo, type PackageScannerOptions, ReadmeContent, type RegenerationScope, type ScanResult, type ScannedPackage, SyncError, type SyncOrchestrator, type SyncOrchestratorOptions, SyncSummary, type ValidationError, type ValidationPipelineOptions, type ValidationResult, type ValidationWarning, categorizeFile, consolidateEvents, createDocChangeDetector, createDocDebouncer, createDocWatcher, createPackageScanner, createSyncOrchestrator, createValidationPipeline, deduplicateEvents, determineRegenerationScope, filterDocumentationChanges, filterPackagesByPattern, groupChangesByPackage, groupPackagesByScope, hasAnyFileChanged, isValidFilePath, validateContentString, validateDocument };
package/lib/index.js ADDED
@@ -0,0 +1,118 @@
1
+ import {
2
+ categorizeFile,
3
+ consolidateEvents,
4
+ createDocChangeDetector,
5
+ createDocDebouncer,
6
+ createDocWatcher,
7
+ createPackageScanner,
8
+ createSyncOrchestrator,
9
+ createValidationPipeline,
10
+ deduplicateEvents,
11
+ determineRegenerationScope,
12
+ filterDocumentationChanges,
13
+ filterPackagesByPattern,
14
+ groupChangesByPackage,
15
+ groupPackagesByScope,
16
+ hasAnyFileChanged,
17
+ isValidFilePath,
18
+ validateContentString,
19
+ validateDocument
20
+ } from "./chunk-DR6UG237.js";
21
+ import {
22
+ cleanCodeExample,
23
+ createBadge,
24
+ createCard,
25
+ createCardGrid,
26
+ createDiffSummary,
27
+ createTabs,
28
+ detectLanguage,
29
+ extractAutoSections,
30
+ extractManualSections,
31
+ formatCodeBlock,
32
+ formatCodeExamples,
33
+ formatFunctionExamples,
34
+ formatGroupedExamples,
35
+ formatTypeExamples,
36
+ formatUsageExample,
37
+ generateAPICompact,
38
+ generateAPIReference,
39
+ generateCategoryReference,
40
+ generateFrontmatter,
41
+ generateInstallTabs,
42
+ generateMDXDocument,
43
+ groupExamplesByCategory,
44
+ hasAutoContent,
45
+ hasManualContent,
46
+ mapToStarlightComponents,
47
+ mergeContent,
48
+ parseFrontmatter,
49
+ sanitizeContent,
50
+ sanitizeTextContent,
51
+ stringifyFrontmatter,
52
+ stripSentinelMarkers,
53
+ validateMDXSyntax,
54
+ validateMarkerPairing,
55
+ wrapAutoSection,
56
+ wrapManualSection
57
+ } from "./chunk-G5KKGJYO.js";
58
+ import {
59
+ SENTINEL_MARKERS
60
+ } from "./chunk-ROLA7SBB.js";
61
+ import "./chunk-6NKAJT2M.js";
62
+ export {
63
+ SENTINEL_MARKERS,
64
+ categorizeFile,
65
+ cleanCodeExample,
66
+ consolidateEvents,
67
+ createBadge,
68
+ createCard,
69
+ createCardGrid,
70
+ createDiffSummary,
71
+ createDocChangeDetector,
72
+ createDocDebouncer,
73
+ createDocWatcher,
74
+ createPackageScanner,
75
+ createSyncOrchestrator,
76
+ createTabs,
77
+ createValidationPipeline,
78
+ deduplicateEvents,
79
+ detectLanguage,
80
+ determineRegenerationScope,
81
+ extractAutoSections,
82
+ extractManualSections,
83
+ filterDocumentationChanges,
84
+ filterPackagesByPattern,
85
+ formatCodeBlock,
86
+ formatCodeExamples,
87
+ formatFunctionExamples,
88
+ formatGroupedExamples,
89
+ formatTypeExamples,
90
+ formatUsageExample,
91
+ generateAPICompact,
92
+ generateAPIReference,
93
+ generateCategoryReference,
94
+ generateFrontmatter,
95
+ generateInstallTabs,
96
+ generateMDXDocument,
97
+ groupChangesByPackage,
98
+ groupExamplesByCategory,
99
+ groupPackagesByScope,
100
+ hasAnyFileChanged,
101
+ hasAutoContent,
102
+ hasManualContent,
103
+ isValidFilePath,
104
+ mapToStarlightComponents,
105
+ mergeContent,
106
+ parseFrontmatter,
107
+ sanitizeContent,
108
+ sanitizeTextContent,
109
+ stringifyFrontmatter,
110
+ stripSentinelMarkers,
111
+ validateContentString,
112
+ validateDocument,
113
+ validateMDXSyntax,
114
+ validateMarkerPairing,
115
+ wrapAutoSection,
116
+ wrapManualSection
117
+ };
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,264 @@
1
+ import { ParseResult, PackageAPI, PackageInfo, ParseError, DocConfigSource, ExportedFunction, ExportedType, JSDocInfo, JSDocParam, JSDocTag, MDXFrontmatter, ReadmeContent, ReadmeSection, ReExport, SyncError } from '../types.js';
2
+ import { ClassDeclaration, EnumDeclaration, FunctionDeclaration, InterfaceDeclaration, TypeAliasDeclaration, Node, JSDocableNode, JSDoc, Project, SourceFile } from 'ts-morph';
3
+ import '@bfra.me/es/result';
4
+ import 'zod';
5
+
6
+ /**
7
+ * @bfra.me/doc-sync/parsers/export-analyzer - Public API surface analyzer for package exports
8
+ */
9
+
10
+ /**
11
+ * Options for analyzing package exports
12
+ */
13
+ interface ExportAnalyzerOptions {
14
+ readonly tsConfigPath?: string;
15
+ readonly followReExports?: boolean;
16
+ readonly maxDepth?: number;
17
+ }
18
+ /**
19
+ * Resolved export information including the original source
20
+ */
21
+ interface ResolvedExport {
22
+ readonly name: string;
23
+ readonly kind: 'function' | 'type' | 'interface' | 'enum' | 'class' | 're-export';
24
+ readonly source: string;
25
+ readonly isDefault: boolean;
26
+ }
27
+ /**
28
+ * Complete analysis of a package's public API
29
+ */
30
+ interface PublicAPIAnalysis {
31
+ readonly packagePath: string;
32
+ readonly entryPoint: string;
33
+ readonly api: PackageAPI;
34
+ readonly resolvedExports: readonly ResolvedExport[];
35
+ }
36
+ /**
37
+ * Analyzes the public API surface of a package from its entry point
38
+ */
39
+ declare function analyzePublicAPI(entryPointPath: string, options?: ExportAnalyzerOptions): ParseResult<PublicAPIAnalysis>;
40
+ /**
41
+ * Finds all exported symbols from a package entry point
42
+ */
43
+ declare function findExportedSymbols(entryPointPath: string, options?: ExportAnalyzerOptions): ParseResult<readonly string[]>;
44
+ /**
45
+ * Checks if a symbol is exported from a package
46
+ */
47
+ declare function isSymbolExported(entryPointPath: string, symbolName: string, options?: ExportAnalyzerOptions): ParseResult<boolean>;
48
+ /**
49
+ * Gets detailed information about a specific exported symbol
50
+ */
51
+ declare function getExportedSymbolInfo(entryPointPath: string, symbolName: string, options?: ExportAnalyzerOptions): ParseResult<ResolvedExport | undefined>;
52
+ /**
53
+ * Filters exports by kind
54
+ */
55
+ declare function getExportsByKind(entryPointPath: string, kind: ResolvedExport['kind'], options?: ExportAnalyzerOptions): ParseResult<readonly ResolvedExport[]>;
56
+
57
+ /**
58
+ * @bfra.me/doc-sync/parsers/guards - Type guards and validation for parser types
59
+ */
60
+
61
+ declare function isParseError(value: unknown): value is ParseError;
62
+ /**
63
+ * Type guard for SyncError
64
+ */
65
+ declare function isSyncError(value: unknown): value is SyncError;
66
+ declare function isJSDocParam(value: unknown): value is JSDocParam;
67
+ declare function isJSDocTag(value: unknown): value is JSDocTag;
68
+ declare function isJSDocInfo(value: unknown): value is JSDocInfo;
69
+ declare function isExportedFunction(value: unknown): value is ExportedFunction;
70
+ declare function isExportedType(value: unknown): value is ExportedType;
71
+ declare function isReExport(value: unknown): value is ReExport;
72
+ declare function isPackageAPI(value: unknown): value is PackageAPI;
73
+ declare function isDocConfigSource(value: unknown): value is DocConfigSource;
74
+ declare function isPackageInfo(value: unknown): value is PackageInfo;
75
+ declare function isReadmeSection(value: unknown): value is ReadmeSection;
76
+ declare function isReadmeContent(value: unknown): value is ReadmeContent;
77
+ declare function isMDXFrontmatter(value: unknown): value is MDXFrontmatter;
78
+ declare function isValidPackageName(name: string): boolean;
79
+ declare function isValidSemver(version: string): boolean;
80
+ declare function isValidHeadingLevel(level: number): level is 1 | 2 | 3 | 4 | 5 | 6;
81
+ /** Checks for potential XSS patterns to prevent injection attacks */
82
+ declare function isSafeContent(content: string): boolean;
83
+ /** Prevents directory traversal attacks in file paths */
84
+ declare function isSafeFilePath(filePath: string): boolean;
85
+ declare function assertParseError(value: unknown): asserts value is ParseError;
86
+ declare function assertPackageInfo(value: unknown): asserts value is PackageInfo;
87
+ declare function assertPackageAPI(value: unknown): asserts value is PackageAPI;
88
+
89
+ /**
90
+ * @bfra.me/doc-sync/parsers/jsdoc-extractor - JSDoc annotation extraction from TypeScript AST nodes
91
+ */
92
+
93
+ /**
94
+ * Supported node types for JSDoc extraction
95
+ */
96
+ type JSDocableDeclaration = ClassDeclaration | EnumDeclaration | FunctionDeclaration | InterfaceDeclaration | TypeAliasDeclaration;
97
+ /**
98
+ * Type guard to check if a node has JSDoc
99
+ */
100
+ declare function hasJSDoc(node: Node): node is Node & JSDocableNode;
101
+ /**
102
+ * Extracts JSDoc information from an AST node
103
+ */
104
+ declare function extractJSDocInfo(node: JSDocableDeclaration): JSDocInfo | undefined;
105
+ /**
106
+ * Parses a JSDoc node into structured information
107
+ */
108
+ declare function parseJSDoc(jsDoc: JSDoc): JSDocInfo;
109
+
110
+ /**
111
+ * @bfra.me/doc-sync/parsers/package-info - Package.json metadata extraction
112
+ */
113
+
114
+ /**
115
+ * Schema for validating package.json structure (runtime validation)
116
+ */
117
+ interface PackageJsonSchema {
118
+ readonly name: string;
119
+ readonly version: string;
120
+ readonly description?: string;
121
+ readonly keywords?: readonly string[];
122
+ readonly main?: string;
123
+ readonly module?: string;
124
+ readonly types?: string;
125
+ readonly exports?: Record<string, unknown>;
126
+ readonly repository?: string | {
127
+ readonly type?: string;
128
+ readonly url?: string;
129
+ readonly directory?: string;
130
+ };
131
+ readonly docs?: DocConfigSource;
132
+ }
133
+ /**
134
+ * Options for parsing package.json files
135
+ */
136
+ interface PackageInfoOptions {
137
+ readonly validateSchema?: boolean;
138
+ readonly extractDocsConfig?: boolean;
139
+ }
140
+ /**
141
+ * Parses a package.json file and extracts relevant metadata
142
+ */
143
+ declare function parsePackageJson(packagePath: string, options?: PackageInfoOptions): Promise<ParseResult<PackageInfo>>;
144
+ /**
145
+ * Parses package.json content from a string
146
+ */
147
+ declare function parsePackageJsonContent(content: string, filePath: string, options?: PackageInfoOptions): ParseResult<PackageInfo>;
148
+ /**
149
+ * Extracts documentation configuration from package.json
150
+ */
151
+ declare function extractDocsConfig(pkg: PackageInfo): DocConfigSource | undefined;
152
+ /**
153
+ * Checks if a README file exists for a package
154
+ */
155
+ declare function findReadmePath(packagePath: string): Promise<string | undefined>;
156
+ /**
157
+ * Extracts the source entry point from package.json
158
+ */
159
+ declare function findEntryPoint(pkg: PackageInfo, content: string): string;
160
+ /**
161
+ * Parses a complete package including README detection
162
+ */
163
+ declare function parsePackageComplete(packagePath: string, options?: PackageInfoOptions): Promise<ParseResult<PackageInfo>>;
164
+ /**
165
+ * Gets the package scope from a scoped package name
166
+ */
167
+ declare function getPackageScope(packageName: string): string | undefined;
168
+ /**
169
+ * Gets the unscoped package name
170
+ */
171
+ declare function getUnscopedName(packageName: string): string;
172
+ /**
173
+ * Builds a documentation slug from a package name
174
+ */
175
+ declare function buildDocSlug(packageName: string): string;
176
+
177
+ /**
178
+ * @bfra.me/doc-sync/parsers/readme-parser - README Markdown parser with section extraction
179
+ */
180
+
181
+ /**
182
+ * Options for parsing README files
183
+ */
184
+ interface ReadmeParserOptions {
185
+ readonly extractSections?: boolean;
186
+ readonly preserveRaw?: boolean;
187
+ }
188
+ /**
189
+ * Parses a README markdown string into structured content
190
+ */
191
+ declare function parseReadme(content: string, options?: ReadmeParserOptions): ParseResult<ReadmeContent>;
192
+ /**
193
+ * Parses a README file from the file system
194
+ */
195
+ declare function parseReadmeFile(filePath: string, options?: ReadmeParserOptions): Promise<ParseResult<ReadmeContent>>;
196
+ /**
197
+ * Finds a section by heading text (case-insensitive)
198
+ */
199
+ declare function findSection(content: ReadmeContent, headingText: string): ReadmeSection | undefined;
200
+ /**
201
+ * Gets all sections at a specific heading level
202
+ */
203
+ declare function getSectionsByLevel(content: ReadmeContent, level: number): readonly ReadmeSection[];
204
+ /**
205
+ * Flattens all sections into a single array
206
+ */
207
+ declare function flattenSections(content: ReadmeContent): readonly ReadmeSection[];
208
+ /**
209
+ * Gets the table of contents as a flat list
210
+ */
211
+ declare function getTableOfContents(content: ReadmeContent): readonly {
212
+ readonly heading: string;
213
+ readonly level: number;
214
+ }[];
215
+
216
+ /**
217
+ * @bfra.me/doc-sync/parsers/typescript-parser - TypeScript source file parser using ts-morph
218
+ */
219
+
220
+ /**
221
+ * Options for parsing TypeScript source files
222
+ */
223
+ interface TypeScriptParserOptions {
224
+ readonly tsConfigPath?: string;
225
+ readonly compilerOptions?: Record<string, unknown>;
226
+ }
227
+ /**
228
+ * Creates a ts-morph project instance for analyzing source files
229
+ */
230
+ declare function createProject(options?: TypeScriptParserOptions): Project;
231
+ /**
232
+ * Parses a TypeScript source file and extracts its structure
233
+ */
234
+ declare function parseSourceFile(project: Project, filePath: string): ParseResult<SourceFile>;
235
+ /**
236
+ * Parses TypeScript source content from a string
237
+ */
238
+ declare function parseSourceContent(project: Project, content: string, virtualPath?: string): ParseResult<SourceFile>;
239
+ /**
240
+ * Extracts exported functions from a source file
241
+ */
242
+ declare function extractExportedFunctions(sourceFile: SourceFile): readonly ExportedFunction[];
243
+ /**
244
+ * Extracts exported types and interfaces from a source file
245
+ */
246
+ declare function extractExportedTypes(sourceFile: SourceFile): readonly ExportedType[];
247
+ /**
248
+ * Extracts re-export statements from a source file
249
+ */
250
+ declare function extractReExports(sourceFile: SourceFile): readonly ReExport[];
251
+ /**
252
+ * Extracts the complete API surface from a source file
253
+ */
254
+ declare function extractPackageAPI(sourceFile: SourceFile): PackageAPI;
255
+ /**
256
+ * Parses and analyzes a TypeScript file, returning the complete API
257
+ */
258
+ declare function analyzeTypeScriptFile(filePath: string, options?: TypeScriptParserOptions): ParseResult<PackageAPI>;
259
+ /**
260
+ * Analyzes TypeScript content from a string
261
+ */
262
+ declare function analyzeTypeScriptContent(content: string, options?: TypeScriptParserOptions): ParseResult<PackageAPI>;
263
+
264
+ export { type ExportAnalyzerOptions, type JSDocableDeclaration, type PackageInfoOptions, type PackageJsonSchema, type PublicAPIAnalysis, type ReadmeParserOptions, type ResolvedExport, type TypeScriptParserOptions, analyzePublicAPI, analyzeTypeScriptContent, analyzeTypeScriptFile, assertPackageAPI, assertPackageInfo, assertParseError, buildDocSlug, createProject, extractDocsConfig, extractExportedFunctions, extractExportedTypes, extractJSDocInfo, extractPackageAPI, extractReExports, findEntryPoint, findExportedSymbols, findReadmePath, findSection, flattenSections, getExportedSymbolInfo, getExportsByKind, getPackageScope, getSectionsByLevel, getTableOfContents, getUnscopedName, hasJSDoc, isDocConfigSource, isExportedFunction, isExportedType, isJSDocInfo, isJSDocParam, isJSDocTag, isMDXFrontmatter, isPackageAPI, isPackageInfo, isParseError, isReExport, isReadmeContent, isReadmeSection, isSafeContent, isSafeFilePath, isSymbolExported, isSyncError, isValidHeadingLevel, isValidPackageName, isValidSemver, parseJSDoc, parsePackageComplete, parsePackageJson, parsePackageJsonContent, parseReadme, parseReadmeFile, parseSourceContent, parseSourceFile };
@@ -0,0 +1,113 @@
1
+ import {
2
+ analyzePublicAPI,
3
+ analyzeTypeScriptContent,
4
+ analyzeTypeScriptFile,
5
+ assertPackageAPI,
6
+ assertPackageInfo,
7
+ assertParseError,
8
+ buildDocSlug,
9
+ createProject,
10
+ extractDocsConfig,
11
+ extractExportedFunctions,
12
+ extractExportedTypes,
13
+ extractJSDocInfo,
14
+ extractPackageAPI,
15
+ extractReExports,
16
+ findEntryPoint,
17
+ findExportedSymbols,
18
+ findReadmePath,
19
+ findSection,
20
+ flattenSections,
21
+ getExportedSymbolInfo,
22
+ getExportsByKind,
23
+ getPackageScope,
24
+ getSectionsByLevel,
25
+ getTableOfContents,
26
+ getUnscopedName,
27
+ hasJSDoc,
28
+ isDocConfigSource,
29
+ isExportedFunction,
30
+ isExportedType,
31
+ isJSDocInfo,
32
+ isJSDocParam,
33
+ isJSDocTag,
34
+ isMDXFrontmatter,
35
+ isPackageAPI,
36
+ isPackageInfo,
37
+ isParseError,
38
+ isReExport,
39
+ isReadmeContent,
40
+ isReadmeSection,
41
+ isSafeContent,
42
+ isSafeFilePath,
43
+ isSymbolExported,
44
+ isSyncError,
45
+ isValidHeadingLevel,
46
+ isValidPackageName,
47
+ isValidSemver,
48
+ parseJSDoc,
49
+ parsePackageComplete,
50
+ parsePackageJson,
51
+ parsePackageJsonContent,
52
+ parseReadme,
53
+ parseReadmeFile,
54
+ parseSourceContent,
55
+ parseSourceFile
56
+ } from "../chunk-6NKAJT2M.js";
57
+ export {
58
+ analyzePublicAPI,
59
+ analyzeTypeScriptContent,
60
+ analyzeTypeScriptFile,
61
+ assertPackageAPI,
62
+ assertPackageInfo,
63
+ assertParseError,
64
+ buildDocSlug,
65
+ createProject,
66
+ extractDocsConfig,
67
+ extractExportedFunctions,
68
+ extractExportedTypes,
69
+ extractJSDocInfo,
70
+ extractPackageAPI,
71
+ extractReExports,
72
+ findEntryPoint,
73
+ findExportedSymbols,
74
+ findReadmePath,
75
+ findSection,
76
+ flattenSections,
77
+ getExportedSymbolInfo,
78
+ getExportsByKind,
79
+ getPackageScope,
80
+ getSectionsByLevel,
81
+ getTableOfContents,
82
+ getUnscopedName,
83
+ hasJSDoc,
84
+ isDocConfigSource,
85
+ isExportedFunction,
86
+ isExportedType,
87
+ isJSDocInfo,
88
+ isJSDocParam,
89
+ isJSDocTag,
90
+ isMDXFrontmatter,
91
+ isPackageAPI,
92
+ isPackageInfo,
93
+ isParseError,
94
+ isReExport,
95
+ isReadmeContent,
96
+ isReadmeSection,
97
+ isSafeContent,
98
+ isSafeFilePath,
99
+ isSymbolExported,
100
+ isSyncError,
101
+ isValidHeadingLevel,
102
+ isValidPackageName,
103
+ isValidSemver,
104
+ parseJSDoc,
105
+ parsePackageComplete,
106
+ parsePackageJson,
107
+ parsePackageJsonContent,
108
+ parseReadme,
109
+ parseReadmeFile,
110
+ parseSourceContent,
111
+ parseSourceFile
112
+ };
113
+ //# sourceMappingURL=index.js.map