@bfra.me/doc-sync 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chunk-45NROJIG.js +327 -0
- package/lib/{chunk-G5KKGJYO.js → chunk-CUBMCGAY.js} +22 -261
- package/lib/chunk-DRBRT57F.js +1 -0
- package/lib/{chunk-DR6UG237.js → chunk-DTXB5PMR.js} +21 -335
- package/lib/chunk-GZ2MP3VN.js +261 -0
- package/lib/chunk-SQSYXPIF.js +1 -0
- package/lib/{chunk-6NKAJT2M.js → chunk-VHUUC45J.js} +35 -3
- package/lib/cli/index.js +5 -3
- package/lib/generators/index.d.ts +1 -3
- package/lib/generators/index.js +2 -1
- package/lib/index.d.ts +7 -139
- package/lib/index.js +146 -13
- package/lib/orchestrator/index.d.ts +82 -0
- package/lib/orchestrator/index.js +27 -0
- package/lib/parsers/index.js +1 -1
- package/lib/utils/index.d.ts +140 -0
- package/lib/utils/index.js +24 -0
- package/lib/watcher/index.d.ts +62 -0
- package/lib/watcher/index.js +25 -0
- package/package.json +17 -2
- package/src/generators/component-mapper.ts +11 -1
- package/src/generators/mdx-generator.ts +18 -17
- package/src/index.ts +82 -0
- package/src/parsers/readme-parser.ts +55 -2
- package/src/utils/safe-patterns.ts +6 -2
|
@@ -1074,11 +1074,11 @@ function extractTextFromNode(node) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
function serializeNode(node) {
|
|
1076
1076
|
if (node.type === "paragraph") {
|
|
1077
|
-
return
|
|
1077
|
+
return serializeInlineContent(node);
|
|
1078
1078
|
}
|
|
1079
1079
|
if (node.type === "heading") {
|
|
1080
1080
|
const prefix = "#".repeat(node.depth);
|
|
1081
|
-
return `${prefix} ${
|
|
1081
|
+
return `${prefix} ${serializeInlineContent(node)}`;
|
|
1082
1082
|
}
|
|
1083
1083
|
if (node.type === "code") {
|
|
1084
1084
|
return `\`\`\`${node.lang ?? ""}
|
|
@@ -1108,6 +1108,38 @@ ${node.value}
|
|
|
1108
1108
|
}
|
|
1109
1109
|
return extractTextFromNode(node);
|
|
1110
1110
|
}
|
|
1111
|
+
function serializeInlineContent(node) {
|
|
1112
|
+
if ("value" in node && typeof node.value === "string") {
|
|
1113
|
+
return node.value;
|
|
1114
|
+
}
|
|
1115
|
+
if (!("children" in node) || !Array.isArray(node.children)) {
|
|
1116
|
+
return "";
|
|
1117
|
+
}
|
|
1118
|
+
return node.children.map((child) => {
|
|
1119
|
+
if (child.type === "strong") {
|
|
1120
|
+
return `**${serializeInlineContent(child)}**`;
|
|
1121
|
+
}
|
|
1122
|
+
if (child.type === "emphasis") {
|
|
1123
|
+
return `*${serializeInlineContent(child)}*`;
|
|
1124
|
+
}
|
|
1125
|
+
if (child.type === "inlineCode") {
|
|
1126
|
+
return `\`${"value" in child ? child.value : ""}\``;
|
|
1127
|
+
}
|
|
1128
|
+
if (child.type === "link") {
|
|
1129
|
+
const text = serializeInlineContent(child);
|
|
1130
|
+
return `[${text}](${"url" in child ? child.url : ""})`;
|
|
1131
|
+
}
|
|
1132
|
+
if (child.type === "image") {
|
|
1133
|
+
const alt = "alt" in child ? child.alt : "";
|
|
1134
|
+
const url = "url" in child ? child.url : "";
|
|
1135
|
+
return ``;
|
|
1136
|
+
}
|
|
1137
|
+
if ("value" in child && typeof child.value === "string") {
|
|
1138
|
+
return child.value;
|
|
1139
|
+
}
|
|
1140
|
+
return serializeInlineContent(child);
|
|
1141
|
+
}).join("");
|
|
1142
|
+
}
|
|
1111
1143
|
function serializeTable(node) {
|
|
1112
1144
|
if (node.type !== "table" || !("children" in node)) {
|
|
1113
1145
|
return "";
|
|
@@ -1230,4 +1262,4 @@ export {
|
|
|
1230
1262
|
flattenSections,
|
|
1231
1263
|
getTableOfContents
|
|
1232
1264
|
};
|
|
1233
|
-
//# sourceMappingURL=chunk-
|
|
1265
|
+
//# sourceMappingURL=chunk-VHUUC45J.js.map
|
package/lib/cli/index.js
CHANGED
|
@@ -3,15 +3,17 @@ import {
|
|
|
3
3
|
createPackageScanner,
|
|
4
4
|
createSyncOrchestrator,
|
|
5
5
|
createValidationPipeline
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-DTXB5PMR.js";
|
|
7
7
|
import {
|
|
8
8
|
generateMDXDocument,
|
|
9
9
|
mergeContent
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-CUBMCGAY.js";
|
|
11
11
|
import "../chunk-ROLA7SBB.js";
|
|
12
12
|
import {
|
|
13
13
|
getUnscopedName
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-VHUUC45J.js";
|
|
15
|
+
import "../chunk-GZ2MP3VN.js";
|
|
16
|
+
import "../chunk-45NROJIG.js";
|
|
15
17
|
|
|
16
18
|
// src/cli/index.ts
|
|
17
19
|
import process4 from "process";
|
|
@@ -160,9 +160,7 @@ declare function generateMDXDocument(packageInfo: PackageInfo, readme: ReadmeCon
|
|
|
160
160
|
declare function sanitizeContent(content: string): string;
|
|
161
161
|
/**
|
|
162
162
|
* Sanitizes content within MDX while preserving JSX components
|
|
163
|
-
*
|
|
164
|
-
* Now includes sanitization of JSX component attributes to prevent XSS
|
|
165
|
-
* Uses safe, non-backtracking parsing to prevent ReDoS
|
|
163
|
+
* Sanitizes JSX component attributes to prevent XSS while leaving closing tags unchanged
|
|
166
164
|
*/
|
|
167
165
|
declare function sanitizeTextContent(content: string): string;
|
|
168
166
|
declare function validateMDXSyntax(mdx: string): Result<true, SyncError>;
|
package/lib/generators/index.js
CHANGED
|
@@ -34,8 +34,9 @@ import {
|
|
|
34
34
|
validateMarkerPairing,
|
|
35
35
|
wrapAutoSection,
|
|
36
36
|
wrapManualSection
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-CUBMCGAY.js";
|
|
38
38
|
import "../chunk-ROLA7SBB.js";
|
|
39
|
+
import "../chunk-GZ2MP3VN.js";
|
|
39
40
|
export {
|
|
40
41
|
cleanCodeExample,
|
|
41
42
|
createBadge,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,141 +1,9 @@
|
|
|
1
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
|
-
|
|
3
|
-
|
|
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';
|
|
2
|
+
export { PackageScannerOptions, ScanResult, ScannedPackage, SyncOrchestrator, SyncOrchestratorOptions, ValidationError, ValidationPipelineOptions, ValidationResult, ValidationWarning, createPackageScanner, createSyncOrchestrator, createValidationPipeline, filterPackagesByPattern, groupPackagesByScope, isValidFilePath, validateContentString, validateDocument } from './orchestrator/index.js';
|
|
3
|
+
export { ExportAnalyzerOptions, JSDocableDeclaration, PackageInfoOptions, PackageJsonSchema, PublicAPIAnalysis, ReadmeParserOptions, ResolvedExport, 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 } from './parsers/index.js';
|
|
4
|
+
export { CLIOptions, DocConfig, DocConfigSource, ExportedFunction, ExportedType, FileChangeEvent, FunctionParameter, InferSchema, JSDocInfo, JSDocParam, JSDocTag, MDXDocument, MDXFrontmatter, PackageAPI, PackageInfo, ParseError, ParseErrorCode, ParseResult, ReExport, ReadmeContent, ReadmeSection, SENTINEL_MARKERS, SyncError, SyncErrorCode, SyncInfo, SyncResult, SyncSummary } from './types.js';
|
|
5
|
+
export { createHeadingPattern, extractCodeBlocks, findEmptyMarkdownLinks, hasComponent, parseJSXAttributes, parseJSXTags, sanitizeAttribute, sanitizeForMDX, sanitizeJSXTag } from './utils/index.js';
|
|
6
|
+
export { BatchChangeHandler, DocChangeDetector, DocChangeDetectorOptions, DocChangeHandler, DocDebouncer, DocDebouncerOptions, DocFileWatcher, DocWatcherOptions, FileCategory, PackageChangeAnalysis, RegenerationScope, categorizeFile, consolidateEvents, createDocChangeDetector, createDocDebouncer, createDocWatcher, deduplicateEvents, determineRegenerationScope, filterDocumentationChanges, groupChangesByPackage, hasAnyFileChanged } from './watcher/index.js';
|
|
7
|
+
import '@bfra.me/es/result';
|
|
8
|
+
import 'ts-morph';
|
|
5
9
|
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
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
+
import "./chunk-SQSYXPIF.js";
|
|
1
2
|
import {
|
|
2
|
-
categorizeFile,
|
|
3
|
-
consolidateEvents,
|
|
4
|
-
createDocChangeDetector,
|
|
5
|
-
createDocDebouncer,
|
|
6
|
-
createDocWatcher,
|
|
7
3
|
createPackageScanner,
|
|
8
4
|
createSyncOrchestrator,
|
|
9
5
|
createValidationPipeline,
|
|
10
|
-
deduplicateEvents,
|
|
11
|
-
determineRegenerationScope,
|
|
12
|
-
filterDocumentationChanges,
|
|
13
6
|
filterPackagesByPattern,
|
|
14
|
-
groupChangesByPackage,
|
|
15
7
|
groupPackagesByScope,
|
|
16
|
-
hasAnyFileChanged,
|
|
17
8
|
isValidFilePath,
|
|
18
9
|
validateContentString,
|
|
19
10
|
validateDocument
|
|
20
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DTXB5PMR.js";
|
|
21
12
|
import {
|
|
22
13
|
cleanCodeExample,
|
|
23
14
|
createBadge,
|
|
@@ -54,13 +45,99 @@ import {
|
|
|
54
45
|
validateMarkerPairing,
|
|
55
46
|
wrapAutoSection,
|
|
56
47
|
wrapManualSection
|
|
57
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CUBMCGAY.js";
|
|
58
49
|
import {
|
|
59
50
|
SENTINEL_MARKERS
|
|
60
51
|
} from "./chunk-ROLA7SBB.js";
|
|
61
|
-
import
|
|
52
|
+
import {
|
|
53
|
+
analyzePublicAPI,
|
|
54
|
+
analyzeTypeScriptContent,
|
|
55
|
+
analyzeTypeScriptFile,
|
|
56
|
+
assertPackageAPI,
|
|
57
|
+
assertPackageInfo,
|
|
58
|
+
assertParseError,
|
|
59
|
+
buildDocSlug,
|
|
60
|
+
createProject,
|
|
61
|
+
extractDocsConfig,
|
|
62
|
+
extractExportedFunctions,
|
|
63
|
+
extractExportedTypes,
|
|
64
|
+
extractJSDocInfo,
|
|
65
|
+
extractPackageAPI,
|
|
66
|
+
extractReExports,
|
|
67
|
+
findEntryPoint,
|
|
68
|
+
findExportedSymbols,
|
|
69
|
+
findReadmePath,
|
|
70
|
+
findSection,
|
|
71
|
+
flattenSections,
|
|
72
|
+
getExportedSymbolInfo,
|
|
73
|
+
getExportsByKind,
|
|
74
|
+
getPackageScope,
|
|
75
|
+
getSectionsByLevel,
|
|
76
|
+
getTableOfContents,
|
|
77
|
+
getUnscopedName,
|
|
78
|
+
hasJSDoc,
|
|
79
|
+
isDocConfigSource,
|
|
80
|
+
isExportedFunction,
|
|
81
|
+
isExportedType,
|
|
82
|
+
isJSDocInfo,
|
|
83
|
+
isJSDocParam,
|
|
84
|
+
isJSDocTag,
|
|
85
|
+
isMDXFrontmatter,
|
|
86
|
+
isPackageAPI,
|
|
87
|
+
isPackageInfo,
|
|
88
|
+
isParseError,
|
|
89
|
+
isReExport,
|
|
90
|
+
isReadmeContent,
|
|
91
|
+
isReadmeSection,
|
|
92
|
+
isSafeContent,
|
|
93
|
+
isSafeFilePath,
|
|
94
|
+
isSymbolExported,
|
|
95
|
+
isSyncError,
|
|
96
|
+
isValidHeadingLevel,
|
|
97
|
+
isValidPackageName,
|
|
98
|
+
isValidSemver,
|
|
99
|
+
parseJSDoc,
|
|
100
|
+
parsePackageComplete,
|
|
101
|
+
parsePackageJson,
|
|
102
|
+
parsePackageJsonContent,
|
|
103
|
+
parseReadme,
|
|
104
|
+
parseReadmeFile,
|
|
105
|
+
parseSourceContent,
|
|
106
|
+
parseSourceFile
|
|
107
|
+
} from "./chunk-VHUUC45J.js";
|
|
108
|
+
import "./chunk-DRBRT57F.js";
|
|
109
|
+
import {
|
|
110
|
+
createHeadingPattern,
|
|
111
|
+
extractCodeBlocks,
|
|
112
|
+
findEmptyMarkdownLinks,
|
|
113
|
+
hasComponent,
|
|
114
|
+
parseJSXAttributes,
|
|
115
|
+
parseJSXTags,
|
|
116
|
+
sanitizeAttribute,
|
|
117
|
+
sanitizeForMDX,
|
|
118
|
+
sanitizeJSXTag
|
|
119
|
+
} from "./chunk-GZ2MP3VN.js";
|
|
120
|
+
import {
|
|
121
|
+
categorizeFile,
|
|
122
|
+
consolidateEvents,
|
|
123
|
+
createDocChangeDetector,
|
|
124
|
+
createDocDebouncer,
|
|
125
|
+
createDocWatcher,
|
|
126
|
+
deduplicateEvents,
|
|
127
|
+
determineRegenerationScope,
|
|
128
|
+
filterDocumentationChanges,
|
|
129
|
+
groupChangesByPackage,
|
|
130
|
+
hasAnyFileChanged
|
|
131
|
+
} from "./chunk-45NROJIG.js";
|
|
62
132
|
export {
|
|
63
133
|
SENTINEL_MARKERS,
|
|
134
|
+
analyzePublicAPI,
|
|
135
|
+
analyzeTypeScriptContent,
|
|
136
|
+
analyzeTypeScriptFile,
|
|
137
|
+
assertPackageAPI,
|
|
138
|
+
assertPackageInfo,
|
|
139
|
+
assertParseError,
|
|
140
|
+
buildDocSlug,
|
|
64
141
|
categorizeFile,
|
|
65
142
|
cleanCodeExample,
|
|
66
143
|
consolidateEvents,
|
|
@@ -71,7 +148,9 @@ export {
|
|
|
71
148
|
createDocChangeDetector,
|
|
72
149
|
createDocDebouncer,
|
|
73
150
|
createDocWatcher,
|
|
151
|
+
createHeadingPattern,
|
|
74
152
|
createPackageScanner,
|
|
153
|
+
createProject,
|
|
75
154
|
createSyncOrchestrator,
|
|
76
155
|
createTabs,
|
|
77
156
|
createValidationPipeline,
|
|
@@ -79,9 +158,22 @@ export {
|
|
|
79
158
|
detectLanguage,
|
|
80
159
|
determineRegenerationScope,
|
|
81
160
|
extractAutoSections,
|
|
161
|
+
extractCodeBlocks,
|
|
162
|
+
extractDocsConfig,
|
|
163
|
+
extractExportedFunctions,
|
|
164
|
+
extractExportedTypes,
|
|
165
|
+
extractJSDocInfo,
|
|
82
166
|
extractManualSections,
|
|
167
|
+
extractPackageAPI,
|
|
168
|
+
extractReExports,
|
|
83
169
|
filterDocumentationChanges,
|
|
84
170
|
filterPackagesByPattern,
|
|
171
|
+
findEmptyMarkdownLinks,
|
|
172
|
+
findEntryPoint,
|
|
173
|
+
findExportedSymbols,
|
|
174
|
+
findReadmePath,
|
|
175
|
+
findSection,
|
|
176
|
+
flattenSections,
|
|
85
177
|
formatCodeBlock,
|
|
86
178
|
formatCodeExamples,
|
|
87
179
|
formatFunctionExamples,
|
|
@@ -94,17 +186,58 @@ export {
|
|
|
94
186
|
generateFrontmatter,
|
|
95
187
|
generateInstallTabs,
|
|
96
188
|
generateMDXDocument,
|
|
189
|
+
getExportedSymbolInfo,
|
|
190
|
+
getExportsByKind,
|
|
191
|
+
getPackageScope,
|
|
192
|
+
getSectionsByLevel,
|
|
193
|
+
getTableOfContents,
|
|
194
|
+
getUnscopedName,
|
|
97
195
|
groupChangesByPackage,
|
|
98
196
|
groupExamplesByCategory,
|
|
99
197
|
groupPackagesByScope,
|
|
100
198
|
hasAnyFileChanged,
|
|
101
199
|
hasAutoContent,
|
|
200
|
+
hasComponent,
|
|
201
|
+
hasJSDoc,
|
|
102
202
|
hasManualContent,
|
|
203
|
+
isDocConfigSource,
|
|
204
|
+
isExportedFunction,
|
|
205
|
+
isExportedType,
|
|
206
|
+
isJSDocInfo,
|
|
207
|
+
isJSDocParam,
|
|
208
|
+
isJSDocTag,
|
|
209
|
+
isMDXFrontmatter,
|
|
210
|
+
isPackageAPI,
|
|
211
|
+
isPackageInfo,
|
|
212
|
+
isParseError,
|
|
213
|
+
isReExport,
|
|
214
|
+
isReadmeContent,
|
|
215
|
+
isReadmeSection,
|
|
216
|
+
isSafeContent,
|
|
217
|
+
isSafeFilePath,
|
|
218
|
+
isSymbolExported,
|
|
219
|
+
isSyncError,
|
|
103
220
|
isValidFilePath,
|
|
221
|
+
isValidHeadingLevel,
|
|
222
|
+
isValidPackageName,
|
|
223
|
+
isValidSemver,
|
|
104
224
|
mapToStarlightComponents,
|
|
105
225
|
mergeContent,
|
|
106
226
|
parseFrontmatter,
|
|
227
|
+
parseJSDoc,
|
|
228
|
+
parseJSXAttributes,
|
|
229
|
+
parseJSXTags,
|
|
230
|
+
parsePackageComplete,
|
|
231
|
+
parsePackageJson,
|
|
232
|
+
parsePackageJsonContent,
|
|
233
|
+
parseReadme,
|
|
234
|
+
parseReadmeFile,
|
|
235
|
+
parseSourceContent,
|
|
236
|
+
parseSourceFile,
|
|
237
|
+
sanitizeAttribute,
|
|
107
238
|
sanitizeContent,
|
|
239
|
+
sanitizeForMDX,
|
|
240
|
+
sanitizeJSXTag,
|
|
108
241
|
sanitizeTextContent,
|
|
109
242
|
stringifyFrontmatter,
|
|
110
243
|
stripSentinelMarkers,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Result } from '@bfra.me/es/result';
|
|
2
|
+
import { PackageInfo, ReadmeContent, PackageAPI, SyncError, DocConfig, SyncSummary, FileChangeEvent, MDXDocument } from '../types.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
interface PackageScannerOptions {
|
|
6
|
+
readonly rootDir: string;
|
|
7
|
+
readonly includePatterns?: readonly string[];
|
|
8
|
+
readonly excludePackages?: readonly string[];
|
|
9
|
+
readonly parseSourceFiles?: boolean;
|
|
10
|
+
readonly parseReadme?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ScannedPackage {
|
|
13
|
+
readonly info: PackageInfo;
|
|
14
|
+
readonly readme?: ReadmeContent;
|
|
15
|
+
readonly api?: PackageAPI;
|
|
16
|
+
readonly sourceFiles: readonly string[];
|
|
17
|
+
readonly needsDocumentation: boolean;
|
|
18
|
+
readonly existingDocPath?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ScanResult {
|
|
21
|
+
readonly packages: readonly ScannedPackage[];
|
|
22
|
+
readonly packagesNeedingDocs: readonly ScannedPackage[];
|
|
23
|
+
readonly errors: readonly SyncError[];
|
|
24
|
+
readonly durationMs: number;
|
|
25
|
+
}
|
|
26
|
+
declare function createPackageScanner(options: PackageScannerOptions): {
|
|
27
|
+
readonly scan: () => Promise<ScanResult>;
|
|
28
|
+
readonly scanPackage: (packagePath: string) => Promise<Result<ScannedPackage, SyncError>>;
|
|
29
|
+
};
|
|
30
|
+
declare function filterPackagesByPattern(packages: readonly ScannedPackage[], pattern: string): ScannedPackage[];
|
|
31
|
+
declare function groupPackagesByScope(packages: readonly ScannedPackage[]): Map<string, ScannedPackage[]>;
|
|
32
|
+
|
|
33
|
+
interface SyncOrchestratorOptions {
|
|
34
|
+
readonly config: DocConfig;
|
|
35
|
+
readonly dryRun?: boolean;
|
|
36
|
+
readonly verbose?: boolean;
|
|
37
|
+
readonly onProgress?: (message: string) => void;
|
|
38
|
+
readonly onError?: (error: SyncError) => void;
|
|
39
|
+
}
|
|
40
|
+
interface SyncOrchestrator {
|
|
41
|
+
readonly syncAll: () => Promise<SyncSummary>;
|
|
42
|
+
readonly syncPackages: (packageNames: readonly string[]) => Promise<SyncSummary>;
|
|
43
|
+
readonly handleChanges: (events: readonly FileChangeEvent[]) => Promise<SyncSummary>;
|
|
44
|
+
readonly startWatching: () => Promise<void>;
|
|
45
|
+
readonly stopWatching: () => Promise<void>;
|
|
46
|
+
readonly isWatching: () => boolean;
|
|
47
|
+
}
|
|
48
|
+
declare function createSyncOrchestrator(options: SyncOrchestratorOptions): SyncOrchestrator;
|
|
49
|
+
/** Prevents directory traversal attacks (SEC-002) */
|
|
50
|
+
declare function isValidFilePath(filePath: string, rootDir: string): boolean;
|
|
51
|
+
|
|
52
|
+
interface ValidationResult {
|
|
53
|
+
readonly valid: boolean;
|
|
54
|
+
readonly errors: readonly ValidationError[];
|
|
55
|
+
readonly warnings: readonly ValidationWarning[];
|
|
56
|
+
}
|
|
57
|
+
interface ValidationError {
|
|
58
|
+
readonly type: 'syntax' | 'frontmatter' | 'component' | 'content';
|
|
59
|
+
readonly message: string;
|
|
60
|
+
readonly line?: number;
|
|
61
|
+
readonly column?: number;
|
|
62
|
+
}
|
|
63
|
+
interface ValidationWarning {
|
|
64
|
+
readonly type: 'deprecation' | 'recommendation' | 'compatibility';
|
|
65
|
+
readonly message: string;
|
|
66
|
+
readonly line?: number;
|
|
67
|
+
}
|
|
68
|
+
interface ValidationPipelineOptions {
|
|
69
|
+
readonly validateFrontmatter?: boolean;
|
|
70
|
+
readonly validateComponents?: boolean;
|
|
71
|
+
readonly validateContent?: boolean;
|
|
72
|
+
readonly strict?: boolean;
|
|
73
|
+
}
|
|
74
|
+
declare function createValidationPipeline(options?: ValidationPipelineOptions): {
|
|
75
|
+
readonly validate: (doc: MDXDocument) => ValidationResult;
|
|
76
|
+
readonly validateContent: (content: string) => ValidationResult;
|
|
77
|
+
readonly validateMultiple: (docs: readonly MDXDocument[]) => Result<Map<string, ValidationResult>, SyncError>;
|
|
78
|
+
};
|
|
79
|
+
declare function validateDocument(doc: MDXDocument, options?: ValidationPipelineOptions): Result<MDXDocument, SyncError>;
|
|
80
|
+
declare function validateContentString(content: string, options?: ValidationPipelineOptions): Result<string, SyncError>;
|
|
81
|
+
|
|
82
|
+
export { type PackageScannerOptions, type ScanResult, type ScannedPackage, type SyncOrchestrator, type SyncOrchestratorOptions, type ValidationError, type ValidationPipelineOptions, type ValidationResult, type ValidationWarning, createPackageScanner, createSyncOrchestrator, createValidationPipeline, filterPackagesByPattern, groupPackagesByScope, isValidFilePath, validateContentString, validateDocument };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "../chunk-SQSYXPIF.js";
|
|
2
|
+
import {
|
|
3
|
+
createPackageScanner,
|
|
4
|
+
createSyncOrchestrator,
|
|
5
|
+
createValidationPipeline,
|
|
6
|
+
filterPackagesByPattern,
|
|
7
|
+
groupPackagesByScope,
|
|
8
|
+
isValidFilePath,
|
|
9
|
+
validateContentString,
|
|
10
|
+
validateDocument
|
|
11
|
+
} from "../chunk-DTXB5PMR.js";
|
|
12
|
+
import "../chunk-CUBMCGAY.js";
|
|
13
|
+
import "../chunk-ROLA7SBB.js";
|
|
14
|
+
import "../chunk-VHUUC45J.js";
|
|
15
|
+
import "../chunk-GZ2MP3VN.js";
|
|
16
|
+
import "../chunk-45NROJIG.js";
|
|
17
|
+
export {
|
|
18
|
+
createPackageScanner,
|
|
19
|
+
createSyncOrchestrator,
|
|
20
|
+
createValidationPipeline,
|
|
21
|
+
filterPackagesByPattern,
|
|
22
|
+
groupPackagesByScope,
|
|
23
|
+
isValidFilePath,
|
|
24
|
+
validateContentString,
|
|
25
|
+
validateDocument
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|