@urbicon-ui/docs-gen 6.1.4
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/README.md +92 -0
- package/dist/cli/CLI.d.ts +10 -0
- package/dist/cli/CLI.d.ts.map +1 -0
- package/dist/cli/CLI.js +340 -0
- package/dist/cli/CLI.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/discovery/ComponentFinder.d.ts +43 -0
- package/dist/core/discovery/ComponentFinder.d.ts.map +1 -0
- package/dist/core/discovery/ComponentFinder.js +421 -0
- package/dist/core/discovery/ComponentFinder.js.map +1 -0
- package/dist/core/discovery/FileStructureAnalyzer.d.ts +15 -0
- package/dist/core/discovery/FileStructureAnalyzer.d.ts.map +1 -0
- package/dist/core/discovery/FileStructureAnalyzer.js +35 -0
- package/dist/core/discovery/FileStructureAnalyzer.js.map +1 -0
- package/dist/core/discovery/MetadataExtractor.d.ts +15 -0
- package/dist/core/discovery/MetadataExtractor.d.ts.map +1 -0
- package/dist/core/discovery/MetadataExtractor.js +47 -0
- package/dist/core/discovery/MetadataExtractor.js.map +1 -0
- package/dist/core/discovery/index.d.ts +2 -0
- package/dist/core/discovery/index.d.ts.map +1 -0
- package/dist/core/discovery/index.js +2 -0
- package/dist/core/discovery/index.js.map +1 -0
- package/dist/core/enrichment/APIDataGenerator.d.ts +77 -0
- package/dist/core/enrichment/APIDataGenerator.d.ts.map +1 -0
- package/dist/core/enrichment/APIDataGenerator.js +663 -0
- package/dist/core/enrichment/APIDataGenerator.js.map +1 -0
- package/dist/core/enrichment/index.d.ts +2 -0
- package/dist/core/enrichment/index.d.ts.map +1 -0
- package/dist/core/enrichment/index.js +6 -0
- package/dist/core/enrichment/index.js.map +1 -0
- package/dist/core/extraction/ExtractionCoordinator.d.ts +53 -0
- package/dist/core/extraction/ExtractionCoordinator.d.ts.map +1 -0
- package/dist/core/extraction/ExtractionCoordinator.js +352 -0
- package/dist/core/extraction/ExtractionCoordinator.js.map +1 -0
- package/dist/core/extraction/index.d.ts +2 -0
- package/dist/core/extraction/index.d.ts.map +1 -0
- package/dist/core/extraction/index.js +2 -0
- package/dist/core/extraction/index.js.map +1 -0
- package/dist/core/generation/GenerationCoordinator.d.ts +51 -0
- package/dist/core/generation/GenerationCoordinator.d.ts.map +1 -0
- package/dist/core/generation/GenerationCoordinator.js +206 -0
- package/dist/core/generation/GenerationCoordinator.js.map +1 -0
- package/dist/core/generation/index.d.ts +2 -0
- package/dist/core/generation/index.d.ts.map +1 -0
- package/dist/core/generation/index.js +2 -0
- package/dist/core/generation/index.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pipeline/ErrorHandler.d.ts +129 -0
- package/dist/core/pipeline/ErrorHandler.d.ts.map +1 -0
- package/dist/core/pipeline/ErrorHandler.js +321 -0
- package/dist/core/pipeline/ErrorHandler.js.map +1 -0
- package/dist/core/pipeline/PipelineOrchestrator.d.ts +45 -0
- package/dist/core/pipeline/PipelineOrchestrator.d.ts.map +1 -0
- package/dist/core/pipeline/PipelineOrchestrator.js +216 -0
- package/dist/core/pipeline/PipelineOrchestrator.js.map +1 -0
- package/dist/core/pipeline/index.d.ts +1 -0
- package/dist/core/pipeline/index.d.ts.map +1 -0
- package/dist/core/pipeline/index.js +2 -0
- package/dist/core/pipeline/index.js.map +1 -0
- package/dist/extractors/BaseExtractor.d.ts +33 -0
- package/dist/extractors/BaseExtractor.d.ts.map +1 -0
- package/dist/extractors/BaseExtractor.js +68 -0
- package/dist/extractors/BaseExtractor.js.map +1 -0
- package/dist/extractors/ExtractorFactory.d.ts +35 -0
- package/dist/extractors/ExtractorFactory.d.ts.map +1 -0
- package/dist/extractors/ExtractorFactory.js +88 -0
- package/dist/extractors/ExtractorFactory.js.map +1 -0
- package/dist/extractors/documentation/index.d.ts +1 -0
- package/dist/extractors/documentation/index.d.ts.map +1 -0
- package/dist/extractors/documentation/index.js +2 -0
- package/dist/extractors/documentation/index.js.map +1 -0
- package/dist/extractors/index.d.ts +1 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/extractors/index.js +2 -0
- package/dist/extractors/index.js.map +1 -0
- package/dist/extractors/typescript/ExamplesExtractor.d.ts +32 -0
- package/dist/extractors/typescript/ExamplesExtractor.d.ts.map +1 -0
- package/dist/extractors/typescript/ExamplesExtractor.js +209 -0
- package/dist/extractors/typescript/ExamplesExtractor.js.map +1 -0
- package/dist/extractors/typescript/InheritanceExtractor.d.ts +45 -0
- package/dist/extractors/typescript/InheritanceExtractor.d.ts.map +1 -0
- package/dist/extractors/typescript/InheritanceExtractor.js +368 -0
- package/dist/extractors/typescript/InheritanceExtractor.js.map +1 -0
- package/dist/extractors/typescript/LocalTypesExtractor.d.ts +20 -0
- package/dist/extractors/typescript/LocalTypesExtractor.d.ts.map +1 -0
- package/dist/extractors/typescript/LocalTypesExtractor.js +100 -0
- package/dist/extractors/typescript/LocalTypesExtractor.js.map +1 -0
- package/dist/extractors/typescript/PropsExtractor.d.ts +142 -0
- package/dist/extractors/typescript/PropsExtractor.d.ts.map +1 -0
- package/dist/extractors/typescript/PropsExtractor.js +709 -0
- package/dist/extractors/typescript/PropsExtractor.js.map +1 -0
- package/dist/extractors/typescript/TypeScriptBaseExtractor.d.ts +74 -0
- package/dist/extractors/typescript/TypeScriptBaseExtractor.d.ts.map +1 -0
- package/dist/extractors/typescript/TypeScriptBaseExtractor.js +249 -0
- package/dist/extractors/typescript/TypeScriptBaseExtractor.js.map +1 -0
- package/dist/extractors/typescript/index.d.ts +1 -0
- package/dist/extractors/typescript/index.d.ts.map +1 -0
- package/dist/extractors/typescript/index.js +2 -0
- package/dist/extractors/typescript/index.js.map +1 -0
- package/dist/extractors/variants/TailwindVariantsParser.d.ts +16 -0
- package/dist/extractors/variants/TailwindVariantsParser.d.ts.map +1 -0
- package/dist/extractors/variants/TailwindVariantsParser.js +53 -0
- package/dist/extractors/variants/TailwindVariantsParser.js.map +1 -0
- package/dist/extractors/variants/VariantsExtractor.d.ts +45 -0
- package/dist/extractors/variants/VariantsExtractor.d.ts.map +1 -0
- package/dist/extractors/variants/VariantsExtractor.js +340 -0
- package/dist/extractors/variants/VariantsExtractor.js.map +1 -0
- package/dist/extractors/variants/index.d.ts +2 -0
- package/dist/extractors/variants/index.d.ts.map +1 -0
- package/dist/extractors/variants/index.js +2 -0
- package/dist/extractors/variants/index.js.map +1 -0
- package/dist/generators/api/APIFileGenerator.d.ts +32 -0
- package/dist/generators/api/APIFileGenerator.d.ts.map +1 -0
- package/dist/generators/api/APIFileGenerator.js +450 -0
- package/dist/generators/api/APIFileGenerator.js.map +1 -0
- package/dist/generators/api/TypeDefinitionGenerator.d.ts +1 -0
- package/dist/generators/api/TypeDefinitionGenerator.d.ts.map +1 -0
- package/dist/generators/api/TypeDefinitionGenerator.js +2 -0
- package/dist/generators/api/TypeDefinitionGenerator.js.map +1 -0
- package/dist/generators/api/index.d.ts +2 -0
- package/dist/generators/api/index.d.ts.map +1 -0
- package/dist/generators/api/index.js +2 -0
- package/dist/generators/api/index.js.map +1 -0
- package/dist/generators/index.d.ts +5 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +4 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/llm/LLMDocumentationGenerator.d.ts +34 -0
- package/dist/generators/llm/LLMDocumentationGenerator.d.ts.map +1 -0
- package/dist/generators/llm/LLMDocumentationGenerator.js +480 -0
- package/dist/generators/llm/LLMDocumentationGenerator.js.map +1 -0
- package/dist/generators/llm/LLMFormatter.d.ts +4 -0
- package/dist/generators/llm/LLMFormatter.d.ts.map +1 -0
- package/dist/generators/llm/LLMFormatter.js +8 -0
- package/dist/generators/llm/LLMFormatter.js.map +1 -0
- package/dist/generators/llm/LlmsFullAssembler.d.ts +20 -0
- package/dist/generators/llm/LlmsFullAssembler.d.ts.map +1 -0
- package/dist/generators/llm/LlmsFullAssembler.js +63 -0
- package/dist/generators/llm/LlmsFullAssembler.js.map +1 -0
- package/dist/generators/llm/index.d.ts +1 -0
- package/dist/generators/llm/index.d.ts.map +1 -0
- package/dist/generators/llm/index.js +2 -0
- package/dist/generators/llm/index.js.map +1 -0
- package/dist/generators/mcp/MCPCatalogAssembler.d.ts +27 -0
- package/dist/generators/mcp/MCPCatalogAssembler.d.ts.map +1 -0
- package/dist/generators/mcp/MCPCatalogAssembler.js +147 -0
- package/dist/generators/mcp/MCPCatalogAssembler.js.map +1 -0
- package/dist/generators/mcp/MCPCatalogGenerator.d.ts +55 -0
- package/dist/generators/mcp/MCPCatalogGenerator.d.ts.map +1 -0
- package/dist/generators/mcp/MCPCatalogGenerator.js +153 -0
- package/dist/generators/mcp/MCPCatalogGenerator.js.map +1 -0
- package/dist/generators/svelte/PageGenerator.d.ts +82 -0
- package/dist/generators/svelte/PageGenerator.d.ts.map +1 -0
- package/dist/generators/svelte/PageGenerator.js +557 -0
- package/dist/generators/svelte/PageGenerator.js.map +1 -0
- package/dist/generators/svelte/PlaygroundPresets.d.ts +2 -0
- package/dist/generators/svelte/PlaygroundPresets.d.ts.map +1 -0
- package/dist/generators/svelte/PlaygroundPresets.js +4 -0
- package/dist/generators/svelte/PlaygroundPresets.js.map +1 -0
- package/dist/generators/svelte/SectionMerger.d.ts +38 -0
- package/dist/generators/svelte/SectionMerger.d.ts.map +1 -0
- package/dist/generators/svelte/SectionMerger.js +154 -0
- package/dist/generators/svelte/SectionMerger.js.map +1 -0
- package/dist/generators/svelte/TemplateEngine.d.ts +91 -0
- package/dist/generators/svelte/TemplateEngine.d.ts.map +1 -0
- package/dist/generators/svelte/TemplateEngine.js +500 -0
- package/dist/generators/svelte/TemplateEngine.js.map +1 -0
- package/dist/generators/svelte/index.d.ts +8 -0
- package/dist/generators/svelte/index.d.ts.map +1 -0
- package/dist/generators/svelte/index.js +11 -0
- package/dist/generators/svelte/index.js.map +1 -0
- package/dist/generators/svelte/renderers/ApiRenderer.d.ts +17 -0
- package/dist/generators/svelte/renderers/ApiRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/ApiRenderer.js +44 -0
- package/dist/generators/svelte/renderers/ApiRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/ExampleRenderer.d.ts +33 -0
- package/dist/generators/svelte/renderers/ExampleRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/ExampleRenderer.js +137 -0
- package/dist/generators/svelte/renderers/ExampleRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/OverviewRenderer.d.ts +9 -0
- package/dist/generators/svelte/renderers/OverviewRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/OverviewRenderer.js +45 -0
- package/dist/generators/svelte/renderers/OverviewRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/PlaygroundRenderer.d.ts +35 -0
- package/dist/generators/svelte/renderers/PlaygroundRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/PlaygroundRenderer.js +319 -0
- package/dist/generators/svelte/renderers/PlaygroundRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/TypesRenderer.d.ts +9 -0
- package/dist/generators/svelte/renderers/TypesRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/TypesRenderer.js +23 -0
- package/dist/generators/svelte/renderers/TypesRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/UsageRenderer.d.ts +14 -0
- package/dist/generators/svelte/renderers/UsageRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/UsageRenderer.js +91 -0
- package/dist/generators/svelte/renderers/UsageRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/VariantsRenderer.d.ts +43 -0
- package/dist/generators/svelte/renderers/VariantsRenderer.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/VariantsRenderer.js +277 -0
- package/dist/generators/svelte/renderers/VariantsRenderer.js.map +1 -0
- package/dist/generators/svelte/renderers/index.d.ts +8 -0
- package/dist/generators/svelte/renderers/index.d.ts.map +1 -0
- package/dist/generators/svelte/renderers/index.js +8 -0
- package/dist/generators/svelte/renderers/index.js.map +1 -0
- package/dist/generators/svelte/types.d.ts +13 -0
- package/dist/generators/svelte/types.d.ts.map +1 -0
- package/dist/generators/svelte/types.js +2 -0
- package/dist/generators/svelte/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/SvelteDocsParser.d.ts +44 -0
- package/dist/parsers/SvelteDocsParser.d.ts.map +1 -0
- package/dist/parsers/SvelteDocsParser.js +141 -0
- package/dist/parsers/SvelteDocsParser.js.map +1 -0
- package/dist/parsers/index.d.ts +2 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +6 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/schema/ConfigurationBuilder.d.ts +55 -0
- package/dist/schema/ConfigurationBuilder.d.ts.map +1 -0
- package/dist/schema/ConfigurationBuilder.js +447 -0
- package/dist/schema/ConfigurationBuilder.js.map +1 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/configuration.d.ts +255 -0
- package/dist/types/configuration.d.ts.map +1 -0
- package/dist/types/configuration.js +2 -0
- package/dist/types/configuration.js.map +1 -0
- package/dist/types/core.d.ts +96 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +2 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/docs-config.d.ts +5 -0
- package/dist/types/docs-config.d.ts.map +1 -0
- package/dist/types/docs-config.js +51 -0
- package/dist/types/docs-config.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/validation.d.ts +321 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +2 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/utils/DeploymentManager.d.ts +80 -0
- package/dist/utils/DeploymentManager.d.ts.map +1 -0
- package/dist/utils/DeploymentManager.js +360 -0
- package/dist/utils/DeploymentManager.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import { isValidSvelteDocsConfig, mergeWithSvelteDocsDefaults } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Simplified parser for docs.svelte files
|
|
5
|
+
* Focuses exclusively on extracting the exported docsConfig.
|
|
6
|
+
* Section parsing has been removed intentionally to reduce complexity.
|
|
7
|
+
*/
|
|
8
|
+
export class SvelteDocsParser {
|
|
9
|
+
/**
|
|
10
|
+
* Parse a docs.svelte file for a component
|
|
11
|
+
* @param componentName Name of the component
|
|
12
|
+
* @param docsFilePath Optional path to the docs file (if not provided, returns defaults)
|
|
13
|
+
*/
|
|
14
|
+
async parseDocsFile(componentName, docsFilePath) {
|
|
15
|
+
console.log(`📄 SvelteDocsParser: Parsing docs for ${componentName}`);
|
|
16
|
+
// If no docs file provided, return defaults immediately
|
|
17
|
+
if (!docsFilePath) {
|
|
18
|
+
console.log(`📄 SvelteDocsParser: No docs file provided for ${componentName} - using defaults`);
|
|
19
|
+
return {
|
|
20
|
+
docsConfig: mergeWithSvelteDocsDefaults({}),
|
|
21
|
+
sections: [],
|
|
22
|
+
exists: false,
|
|
23
|
+
errors: [],
|
|
24
|
+
warnings: []
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
console.log(`📄 SvelteDocsParser: Using docs file: ${docsFilePath}`);
|
|
28
|
+
try {
|
|
29
|
+
// Read the file content
|
|
30
|
+
const content = await fs.readFile(docsFilePath, 'utf-8');
|
|
31
|
+
console.log(`📄 SvelteDocsParser: Found docs.svelte, content length: ${content.length}`);
|
|
32
|
+
// Extract docsConfig from content
|
|
33
|
+
const docsConfig = this.extractDocsConfig(content);
|
|
34
|
+
console.log(`📄 SvelteDocsParser: Extracted docsConfig:`, docsConfig);
|
|
35
|
+
// Validate the configuration
|
|
36
|
+
const validation = this.validateConfig(docsConfig);
|
|
37
|
+
return {
|
|
38
|
+
docsConfig: mergeWithSvelteDocsDefaults(docsConfig),
|
|
39
|
+
sections: [], // Section parsing intentionally removed
|
|
40
|
+
exists: true,
|
|
41
|
+
errors: validation.errors,
|
|
42
|
+
warnings: validation.warnings
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(`📄 SvelteDocsParser: Error parsing ${docsFilePath}:`, error);
|
|
47
|
+
return {
|
|
48
|
+
docsConfig: mergeWithSvelteDocsDefaults({}),
|
|
49
|
+
sections: [],
|
|
50
|
+
exists: true, // File exists but has parsing errors
|
|
51
|
+
errors: [
|
|
52
|
+
`Failed to parse docs.svelte: ${error instanceof Error ? error.message : String(error)}`
|
|
53
|
+
],
|
|
54
|
+
warnings: []
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// ==========================================
|
|
59
|
+
// DOCS CONFIG EXTRACTION
|
|
60
|
+
// ==========================================
|
|
61
|
+
/**
|
|
62
|
+
* Extract export const docsConfig from script block using regex
|
|
63
|
+
* Simplified approach focused on modern Svelte 5 syntax only
|
|
64
|
+
*/
|
|
65
|
+
extractDocsConfig(content) {
|
|
66
|
+
console.log(`🔍 SvelteDocsParser: Extracting docsConfig from content`);
|
|
67
|
+
try {
|
|
68
|
+
// Find export const docsConfig = { ... }; pattern
|
|
69
|
+
const typedPattern = /export\s+const\s+docsConfig\s*:\s*SvelteDocsConfig\s*=\s*({[\s\S]*?});/;
|
|
70
|
+
const untypedPattern = /export\s+const\s+docsConfig\s*=\s*({[\s\S]*?});/;
|
|
71
|
+
const match = content.match(typedPattern) || content.match(untypedPattern);
|
|
72
|
+
if (!match) {
|
|
73
|
+
console.log(`🔍 SvelteDocsParser: No docsConfig export found`);
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
const configString = match[1];
|
|
77
|
+
console.log(`🔍 SvelteDocsParser: Found config string (first 200 chars):`, `${configString.substring(0, 200)}...`);
|
|
78
|
+
// Parse the object literal
|
|
79
|
+
const config = this.parseConfigObject(configString);
|
|
80
|
+
return config;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.warn(`🔍 SvelteDocsParser: Failed to extract docsConfig:`, error);
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parse config object string into SvelteDocsConfig
|
|
89
|
+
* Uses eval for object literals (safe in build context)
|
|
90
|
+
*/
|
|
91
|
+
parseConfigObject(configString) {
|
|
92
|
+
try {
|
|
93
|
+
// Use eval directly since we're in a controlled build environment
|
|
94
|
+
// and the content comes from our own source files
|
|
95
|
+
console.log(`🔍 SvelteDocsParser: Parsing config object with eval`);
|
|
96
|
+
// biome-ignore lint/security/noGlobalEval: build-time parse of our own doc-config object literals, never runtime or user input (see above).
|
|
97
|
+
return eval(`(${configString})`);
|
|
98
|
+
}
|
|
99
|
+
catch (evalError) {
|
|
100
|
+
console.error(`🔍 SvelteDocsParser: Failed to parse config object:`, evalError);
|
|
101
|
+
console.error(`🔍 SvelteDocsParser: Config string was:`, configString.substring(0, 300));
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// ==========================================
|
|
106
|
+
// VALIDATION
|
|
107
|
+
// ==========================================
|
|
108
|
+
/**
|
|
109
|
+
* Validate docs configuration
|
|
110
|
+
*/
|
|
111
|
+
validateConfig(config) {
|
|
112
|
+
const errors = [];
|
|
113
|
+
const warnings = [];
|
|
114
|
+
const suggestions = [];
|
|
115
|
+
if (!isValidSvelteDocsConfig(config)) {
|
|
116
|
+
errors.push('Invalid docs configuration structure');
|
|
117
|
+
}
|
|
118
|
+
// Check for common issues
|
|
119
|
+
if (config.generation?.playground?.featured &&
|
|
120
|
+
config.generation.playground.featured.length === 0) {
|
|
121
|
+
warnings.push('Playground featured array is empty - consider removing or adding props');
|
|
122
|
+
}
|
|
123
|
+
if (config.generation?.variants?.exclude && config.generation.variants.exclude.length > 5) {
|
|
124
|
+
warnings.push('Many variants excluded - consider reviewing variant design');
|
|
125
|
+
}
|
|
126
|
+
// Suggestions for better docs
|
|
127
|
+
if (!config.meta?.description) {
|
|
128
|
+
suggestions.push('Consider adding a component description for better documentation');
|
|
129
|
+
}
|
|
130
|
+
if (config.llm?.include === undefined) {
|
|
131
|
+
suggestions.push('Consider explicitly setting llm.include to control LLM documentation generation');
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
valid: errors.length === 0,
|
|
135
|
+
errors,
|
|
136
|
+
warnings,
|
|
137
|
+
suggestions
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=SvelteDocsParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvelteDocsParser.js","sourceRoot":"","sources":["../../src/parsers/SvelteDocsParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAkBhF;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;;;OAIG;IACH,KAAK,CAAC,aAAa,CACjB,aAAqB,EACrB,YAAqB;QAErB,OAAO,CAAC,GAAG,CAAC,yCAAyC,aAAa,EAAE,CAAC,CAAC;QAEtE,wDAAwD;QACxD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,C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AI,CACd,iFAAiF,CAClF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;YACN,QAAQ;YACR,WAAW;SACZ,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,6CAA6C;AAC7C,yBAAyB;AACzB,6CAA6C;AAE7C,OAAO,EAA8B,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ConfigValidationResult, GeneratorConfig, GeneratorConfigBuilder, PackageConfig, TypeScriptConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builder for creating and validating documentation configurations
|
|
4
|
+
*/
|
|
5
|
+
export declare class DocsConfigurationBuilder implements GeneratorConfigBuilder {
|
|
6
|
+
private config;
|
|
7
|
+
constructor(baseConfig?: Partial<GeneratorConfig>);
|
|
8
|
+
addPackage(packageConfig: PackageConfig): GeneratorConfigBuilder;
|
|
9
|
+
setTypeScript(tsConfig: TypeScriptConfig): GeneratorConfigBuilder;
|
|
10
|
+
setSchema(schemaConfig: Partial<GeneratorConfig['input']['schema']>): GeneratorConfigBuilder;
|
|
11
|
+
setExtraction(extractionConfig: Partial<GeneratorConfig['processing']['extraction']>): GeneratorConfigBuilder;
|
|
12
|
+
setEnrichment(enrichmentConfig: Partial<GeneratorConfig['processing']['enrichment']>): GeneratorConfigBuilder;
|
|
13
|
+
setValidation(validationConfig: Partial<GeneratorConfig['processing']['validation']>): GeneratorConfigBuilder;
|
|
14
|
+
enableParallel(parallelConfig?: Partial<GeneratorConfig['processing']['parallel']>): GeneratorConfigBuilder;
|
|
15
|
+
setLLMOutput(llmConfig: Partial<GeneratorConfig['output']['llm']>): GeneratorConfigBuilder;
|
|
16
|
+
setAPIOutput(apiConfig: Partial<GeneratorConfig['output']['api']>): GeneratorConfigBuilder;
|
|
17
|
+
enableWatch(watchConfig?: Partial<GeneratorConfig['watch']>): GeneratorConfigBuilder;
|
|
18
|
+
enableDebug(debugConfig?: Partial<GeneratorConfig['debug']>): GeneratorConfigBuilder;
|
|
19
|
+
validate(): ConfigValidationResult;
|
|
20
|
+
build(): GeneratorConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Reset to default configuration
|
|
23
|
+
*/
|
|
24
|
+
reset(): GeneratorConfigBuilder;
|
|
25
|
+
}
|
|
26
|
+
export declare class ConfigurationFactory {
|
|
27
|
+
/**
|
|
28
|
+
* Create Blocks-specific configuration
|
|
29
|
+
*/
|
|
30
|
+
static blocks(): GeneratorConfig;
|
|
31
|
+
/**
|
|
32
|
+
* Create Docs-specific configuration
|
|
33
|
+
*/
|
|
34
|
+
static docs(): GeneratorConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Create Table-specific configuration
|
|
37
|
+
*/
|
|
38
|
+
static table(): GeneratorConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Create Auth-specific configuration
|
|
41
|
+
*/
|
|
42
|
+
static auth(): GeneratorConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Create single package configuration
|
|
45
|
+
*/
|
|
46
|
+
static singlePackage(packagePath: string, packageName: string): GeneratorConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Load configuration from file
|
|
49
|
+
*/
|
|
50
|
+
static fromFile(configPath: string): Promise<GeneratorConfig>;
|
|
51
|
+
private static loadJSONConfig;
|
|
52
|
+
private static loadESModuleConfig;
|
|
53
|
+
private static validateAndBuildConfig;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=ConfigurationBuil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IAY1F,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,sBAAsB;IAUpF,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,sBAAsB;IAgBpF,QAAQ,IAAI,sBAAsB;IAiClC,KAAK,IAAI,eAAe;IAoBxB;;OAEG;IACH,KAAK,IAAI,sBAAsB;CAIhC;AAOD,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,MAAM,IAAI,eAAe;IA2BhC;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,eAAe;IA0B9B;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,eAAe;IAyB/B;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,eAAe;IAuB9B;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,eAAe;IAc/E;;OAEG;WACU,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;mBAmC9C,cAAc;mBAOd,kBAAkB;IAcvC,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAoDtC"}
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
// ==========================================
|
|
5
|
+
// DEFAULT CONFIGURATION FACTORY
|
|
6
|
+
// ==========================================
|
|
7
|
+
/**
|
|
8
|
+
* Creates a complete default configuration
|
|
9
|
+
*/
|
|
10
|
+
function createDefaultConfig() {
|
|
11
|
+
return {
|
|
12
|
+
input: {
|
|
13
|
+
packages: [],
|
|
14
|
+
schema: {
|
|
15
|
+
version: '2.0.0',
|
|
16
|
+
strict: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
processing: {
|
|
20
|
+
extraction: {
|
|
21
|
+
typescript: {
|
|
22
|
+
extractJSDoc: true,
|
|
23
|
+
extractTypeReferences: true,
|
|
24
|
+
extractDefaultValues: true,
|
|
25
|
+
resolveTypeAliases: true
|
|
26
|
+
},
|
|
27
|
+
variants: {
|
|
28
|
+
frameworks: ['tailwind-variants'],
|
|
29
|
+
extractDefaults: true
|
|
30
|
+
},
|
|
31
|
+
documentation: {
|
|
32
|
+
validateSchema: true,
|
|
33
|
+
allowPartialDocs: false
|
|
34
|
+
},
|
|
35
|
+
inheritance: {
|
|
36
|
+
resolveExternalTypes: true,
|
|
37
|
+
includeHTMLAttributes: true,
|
|
38
|
+
maxDepth: 5
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
enrichment: {
|
|
42
|
+
crossReferences: {
|
|
43
|
+
enabled: true,
|
|
44
|
+
includeExternal: true
|
|
45
|
+
},
|
|
46
|
+
metadata: {
|
|
47
|
+
extractStats: true,
|
|
48
|
+
calculateComplexity: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
validation: {
|
|
52
|
+
rules: [],
|
|
53
|
+
schema: {
|
|
54
|
+
enabled: true,
|
|
55
|
+
failOnError: false
|
|
56
|
+
},
|
|
57
|
+
examples: {
|
|
58
|
+
syntax: true
|
|
59
|
+
},
|
|
60
|
+
components: {}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
output: {
|
|
64
|
+
llm: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
// Write into a directory by default to enable per-component files
|
|
67
|
+
outputPath: './generated/llm',
|
|
68
|
+
format: 'markdown'
|
|
69
|
+
},
|
|
70
|
+
api: {
|
|
71
|
+
enabled: true,
|
|
72
|
+
outputPath: './src/lib/generated/api-props.ts',
|
|
73
|
+
format: 'typescript'
|
|
74
|
+
},
|
|
75
|
+
shared: {
|
|
76
|
+
clean: true,
|
|
77
|
+
createDirectories: true,
|
|
78
|
+
overwrite: true,
|
|
79
|
+
backup: {
|
|
80
|
+
enabled: false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Builder for creating and validating documentation configurations
|
|
88
|
+
*/
|
|
89
|
+
export class DocsConfigurationBuilder {
|
|
90
|
+
config;
|
|
91
|
+
constructor(baseConfig) {
|
|
92
|
+
this.config = createDefaultConfig();
|
|
93
|
+
// If a baseConfig is provided, merge it with the defaults
|
|
94
|
+
if (baseConfig) {
|
|
95
|
+
this.config = JSON.parse(JSON.stringify({ ...this.config, ...baseConfig }));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// ==========================================
|
|
99
|
+
// INPUT CONFIGURATION
|
|
100
|
+
// ==========================================
|
|
101
|
+
addPackage(packageConfig) {
|
|
102
|
+
this.config.input.packages.push(packageConfig);
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
setTypeScript(tsConfig) {
|
|
106
|
+
this.config.input.typescript = tsConfig;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
setSchema(schemaConfig) {
|
|
110
|
+
this.config.input.schema = {
|
|
111
|
+
...this.config.input.schema,
|
|
112
|
+
...schemaConfig
|
|
113
|
+
};
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
// ==========================================
|
|
117
|
+
// PROCESSING CONFIGURATION
|
|
118
|
+
// ==========================================
|
|
119
|
+
setExtraction(extractionConfig) {
|
|
120
|
+
this.config.processing.extraction = {
|
|
121
|
+
...this.config.processing.extraction,
|
|
122
|
+
...extractionConfig
|
|
123
|
+
};
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
setEnrichment(enrichmentConfig) {
|
|
127
|
+
this.config.processing.enrichment = {
|
|
128
|
+
...this.config.processing.enrichment,
|
|
129
|
+
...enrichmentConfig
|
|
130
|
+
};
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
setValidation(validationConfig) {
|
|
134
|
+
this.config.processing.validation = {
|
|
135
|
+
...this.config.processing.validation,
|
|
136
|
+
...validationConfig
|
|
137
|
+
};
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
enableParallel(parallelConfig) {
|
|
141
|
+
this.config.processing.parallel = {
|
|
142
|
+
enabled: true,
|
|
143
|
+
maxConcurrency: 4,
|
|
144
|
+
strategy: 'auto',
|
|
145
|
+
...parallelConfig
|
|
146
|
+
};
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
// ==========================================
|
|
150
|
+
// OUTPUT CONFIGURATION
|
|
151
|
+
// ==========================================
|
|
152
|
+
setLLMOutput(llmConfig) {
|
|
153
|
+
this.config.output.llm = {
|
|
154
|
+
...this.config.output.llm,
|
|
155
|
+
...llmConfig
|
|
156
|
+
};
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
setAPIOutput(apiConfig) {
|
|
160
|
+
this.config.output.api = {
|
|
161
|
+
...this.config.output.api,
|
|
162
|
+
...apiConfig
|
|
163
|
+
};
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
// ==========================================
|
|
167
|
+
// ADDITIONAL FEATURES
|
|
168
|
+
// ==========================================
|
|
169
|
+
enableWatch(watchConfig) {
|
|
170
|
+
this.config.watch = {
|
|
171
|
+
enabled: true,
|
|
172
|
+
debounce: 1000,
|
|
173
|
+
events: ['add', 'change', 'unlink'],
|
|
174
|
+
...watchConfig
|
|
175
|
+
};
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
enableDebug(debugConfig) {
|
|
179
|
+
this.config.debug = {
|
|
180
|
+
enabled: true,
|
|
181
|
+
level: 'info',
|
|
182
|
+
output: {
|
|
183
|
+
console: true
|
|
184
|
+
},
|
|
185
|
+
...debugConfig
|
|
186
|
+
};
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
// ==========================================
|
|
190
|
+
// BUILD & VALIDATE
|
|
191
|
+
// ==========================================
|
|
192
|
+
validate() {
|
|
193
|
+
const errors = [];
|
|
194
|
+
const warnings = [];
|
|
195
|
+
// Basic validation
|
|
196
|
+
if (!this.config.input.packages.length) {
|
|
197
|
+
errors.push({
|
|
198
|
+
path: 'input.packages',
|
|
199
|
+
message: 'At least one package must be configured'
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (!this.config.output.llm.outputPath && this.config.output.llm.enabled) {
|
|
203
|
+
errors.push({
|
|
204
|
+
path: 'output.llm.outputPath',
|
|
205
|
+
message: 'LLM output path is required when LLM output is enabled'
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (!this.config.output.api.outputPath && this.config.output.api.enabled) {
|
|
209
|
+
errors.push({
|
|
210
|
+
path: 'output.api.outputPath',
|
|
211
|
+
message: 'API output path is required when API output is enabled'
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
valid: errors.length === 0,
|
|
216
|
+
errors,
|
|
217
|
+
warnings
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
build() {
|
|
221
|
+
const validation = this.validate();
|
|
222
|
+
if (!validation.valid) {
|
|
223
|
+
throw new Error(`Configuration validation failed: ${validation.errors.map((e) => e.message).join(', ')}`);
|
|
224
|
+
}
|
|
225
|
+
if (validation.warnings && validation.warnings.length > 0) {
|
|
226
|
+
console.warn('Configuration warnings:', validation.warnings.map((w) => w.message));
|
|
227
|
+
}
|
|
228
|
+
// No type cast needed anymore
|
|
229
|
+
return this.config;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Reset to default configuration
|
|
233
|
+
*/
|
|
234
|
+
reset() {
|
|
235
|
+
this.config = createDefaultConfig();
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// ==========================================
|
|
240
|
+
// CONFIGURATION FACTORY - Preset configurations
|
|
241
|
+
// ==========================================
|
|
242
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: intentional namespace grouping of config factories.
|
|
243
|
+
export class ConfigurationFactory {
|
|
244
|
+
/**
|
|
245
|
+
* Create Blocks-specific configuration
|
|
246
|
+
*/
|
|
247
|
+
static blocks() {
|
|
248
|
+
return new DocsConfigurationBuilder()
|
|
249
|
+
.addPackage({
|
|
250
|
+
name: '@urbicon-ui/blocks',
|
|
251
|
+
path: '../blocks',
|
|
252
|
+
glob: {
|
|
253
|
+
components: 'src/lib/{primitives,components}/**/index.ts',
|
|
254
|
+
variants: 'src/lib/{primitives,components}/**/*.variants.ts',
|
|
255
|
+
documentation: 'src/lib/{primitives,components}/**/docs.svelte'
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
.setLLMOutput({
|
|
259
|
+
enabled: true,
|
|
260
|
+
// New static layout under blocks with grouping
|
|
261
|
+
outputPath: '../../apps/docs/static/blocks',
|
|
262
|
+
format: 'text'
|
|
263
|
+
})
|
|
264
|
+
.setAPIOutput({
|
|
265
|
+
enabled: true,
|
|
266
|
+
// Directory mode; will write per-component api.ts under group folder (components/primitives)
|
|
267
|
+
outputPath: '../../apps/docs/src/routes/blocks',
|
|
268
|
+
format: 'typescript'
|
|
269
|
+
})
|
|
270
|
+
.build();
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Create Docs-specific configuration
|
|
274
|
+
*/
|
|
275
|
+
static docs() {
|
|
276
|
+
return new DocsConfigurationBuilder()
|
|
277
|
+
.addPackage({
|
|
278
|
+
name: '@urbicon-ui/docs',
|
|
279
|
+
path: '../docs',
|
|
280
|
+
glob: {
|
|
281
|
+
components: 'src/lib/components/**/index.ts',
|
|
282
|
+
variants: 'src/lib/components/**/*.variants.ts',
|
|
283
|
+
documentation: 'src/lib/components/**/docs.svelte'
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
.setLLMOutput({
|
|
287
|
+
enabled: true,
|
|
288
|
+
// Write under SvelteKit static path, mirroring routes hierarchy
|
|
289
|
+
outputPath: '../../apps/docs/static/docs',
|
|
290
|
+
format: 'text'
|
|
291
|
+
})
|
|
292
|
+
.setAPIOutput({
|
|
293
|
+
enabled: true,
|
|
294
|
+
outputPath: '../../apps/docs/src/routes/docs',
|
|
295
|
+
format: 'typescript'
|
|
296
|
+
})
|
|
297
|
+
.build();
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Create Table-specific configuration
|
|
301
|
+
*/
|
|
302
|
+
static table() {
|
|
303
|
+
return new DocsConfigurationBuilder()
|
|
304
|
+
.addPackage({
|
|
305
|
+
name: '@urbicon-ui/table',
|
|
306
|
+
path: '../table',
|
|
307
|
+
glob: {
|
|
308
|
+
components: 'src/lib/core/table/index.ts',
|
|
309
|
+
documentation: 'src/lib/core/table/docs.svelte'
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
.setLLMOutput({
|
|
313
|
+
enabled: true,
|
|
314
|
+
// Write under SvelteKit static path, mirroring routes hierarchy
|
|
315
|
+
outputPath: '../../apps/docs/static/table',
|
|
316
|
+
format: 'text'
|
|
317
|
+
})
|
|
318
|
+
.setAPIOutput({
|
|
319
|
+
enabled: true,
|
|
320
|
+
outputPath: '../../apps/docs/src/routes/table',
|
|
321
|
+
format: 'typescript'
|
|
322
|
+
})
|
|
323
|
+
.build();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Create Auth-specific configuration
|
|
327
|
+
*/
|
|
328
|
+
static auth() {
|
|
329
|
+
return new DocsConfigurationBuilder()
|
|
330
|
+
.addPackage({
|
|
331
|
+
name: '@urbicon-ui/auth',
|
|
332
|
+
path: '../auth',
|
|
333
|
+
glob: {
|
|
334
|
+
components: 'src/lib/client/components/*/index.ts'
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
.setLLMOutput({
|
|
338
|
+
enabled: true,
|
|
339
|
+
outputPath: '../../apps/docs/static/auth',
|
|
340
|
+
format: 'text'
|
|
341
|
+
})
|
|
342
|
+
.setAPIOutput({
|
|
343
|
+
enabled: true,
|
|
344
|
+
outputPath: '../../apps/docs/src/routes/auth',
|
|
345
|
+
format: 'typescript'
|
|
346
|
+
})
|
|
347
|
+
.build();
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Create single package configuration
|
|
351
|
+
*/
|
|
352
|
+
static singlePackage(packagePath, packageName) {
|
|
353
|
+
return new DocsConfigurationBuilder()
|
|
354
|
+
.addPackage({
|
|
355
|
+
name: packageName,
|
|
356
|
+
path: packagePath,
|
|
357
|
+
glob: {
|
|
358
|
+
components: 'src/components/*/index.ts',
|
|
359
|
+
variants: 'src/components/*/*.variants.ts',
|
|
360
|
+
documentation: 'src/components/*/docs.ts'
|
|
361
|
+
}
|
|
362
|
+
})
|
|
363
|
+
.build();
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Load configuration from file
|
|
367
|
+
*/
|
|
368
|
+
static async fromFile(configPath) {
|
|
369
|
+
try {
|
|
370
|
+
const absolutePath = path.resolve(configPath);
|
|
371
|
+
// Check if file exists
|
|
372
|
+
await fs.access(absolutePath);
|
|
373
|
+
console.log(`📋 Loading configuration from: ${absolutePath}`);
|
|
374
|
+
// Determine file type and load accordingly
|
|
375
|
+
const ext = path.extname(absolutePath).toLowerCase();
|
|
376
|
+
switch (ext) {
|
|
377
|
+
case '.json':
|
|
378
|
+
return ConfigurationFactory.loadJSONConfig(absolutePath);
|
|
379
|
+
case '.js':
|
|
380
|
+
case '.mjs':
|
|
381
|
+
case '.ts':
|
|
382
|
+
return ConfigurationFactory.loadESModuleConfig(absolutePath);
|
|
383
|
+
default:
|
|
384
|
+
throw new Error(`Unsupported config file type: ${ext}. Supported: .json, .js, .mjs, .ts`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
if (error instanceof Error && error.message.includes('ENOENT')) {
|
|
389
|
+
throw new Error(`Configuration file not found: ${configPath}`, { cause: error });
|
|
390
|
+
}
|
|
391
|
+
throw new Error(`Failed to load configuration from ${configPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
static async loadJSONConfig(filePath) {
|
|
395
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
396
|
+
const configData = JSON.parse(content);
|
|
397
|
+
return ConfigurationFactory.validateAndBuildConfig(configData, filePath);
|
|
398
|
+
}
|
|
399
|
+
static async loadESModuleConfig(filePath) {
|
|
400
|
+
// Use dynamic import to load ES modules
|
|
401
|
+
const configModule = await import(fileURLToPath(filePath));
|
|
402
|
+
const configData = configModule.default || configModule.config;
|
|
403
|
+
if (!configData) {
|
|
404
|
+
throw new Error(`Configuration file must export a default config or named 'config' export: ${filePath}`);
|
|
405
|
+
}
|
|
406
|
+
return ConfigurationFactory.validateAndBuildConfig(configData, filePath);
|
|
407
|
+
}
|
|
408
|
+
static validateAndBuildConfig(configData, filePath) {
|
|
409
|
+
// Create builder and populate with loaded data
|
|
410
|
+
const builder = new DocsConfigurationBuilder();
|
|
411
|
+
// Apply loaded configuration data
|
|
412
|
+
if (configData.input?.packages) {
|
|
413
|
+
configData.input.packages.forEach((pkg) => {
|
|
414
|
+
builder.addPackage(pkg);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
if (configData.input?.typescript) {
|
|
418
|
+
builder.setTypeScript(configData.input.typescript);
|
|
419
|
+
}
|
|
420
|
+
if (configData.processing?.extraction) {
|
|
421
|
+
builder.setExtraction(configData.processing.extraction);
|
|
422
|
+
}
|
|
423
|
+
if (configData.processing?.enrichment) {
|
|
424
|
+
builder.setEnrichment(configData.processing.enrichment);
|
|
425
|
+
}
|
|
426
|
+
if (configData.processing?.validation) {
|
|
427
|
+
builder.setValidation(configData.processing.validation);
|
|
428
|
+
}
|
|
429
|
+
if (configData.output?.llm) {
|
|
430
|
+
builder.setLLMOutput(configData.output.llm);
|
|
431
|
+
}
|
|
432
|
+
if (configData.output?.api) {
|
|
433
|
+
builder.setAPIOutput(configData.output.api);
|
|
434
|
+
}
|
|
435
|
+
if (configData.watch) {
|
|
436
|
+
builder.enableWatch(configData.watch);
|
|
437
|
+
}
|
|
438
|
+
if (configData.debug) {
|
|
439
|
+
builder.enableDebug(configData.debug);
|
|
440
|
+
}
|
|
441
|
+
// Build and validate
|
|
442
|
+
const config = builder.build();
|
|
443
|
+
console.log(`✅ Configuration loaded successfully from ${filePath}`);
|
|
444
|
+
return config;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
//# sourceMappingURL=ConfigurationBuilder.js.map
|