@commercetools/nimbus-docs-build 0.0.0-canary-20251107124701

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 (138) hide show
  1. package/README.md +129 -0
  2. package/dist/assets/index.d.ts +5 -0
  3. package/dist/assets/index.d.ts.map +1 -0
  4. package/dist/assets/index.js +5 -0
  5. package/dist/assets/index.js.map +1 -0
  6. package/dist/assets/optimize-assets.d.ts +5 -0
  7. package/dist/assets/optimize-assets.d.ts.map +1 -0
  8. package/dist/assets/optimize-assets.js +36 -0
  9. package/dist/assets/optimize-assets.js.map +1 -0
  10. package/dist/builders/build.d.ts +6 -0
  11. package/dist/builders/build.d.ts.map +1 -0
  12. package/dist/builders/build.js +65 -0
  13. package/dist/builders/build.js.map +1 -0
  14. package/dist/builders/index.d.ts +8 -0
  15. package/dist/builders/index.d.ts.map +1 -0
  16. package/dist/builders/index.js +8 -0
  17. package/dist/builders/index.js.map +1 -0
  18. package/dist/builders/manifest-builder.d.ts +6 -0
  19. package/dist/builders/manifest-builder.d.ts.map +1 -0
  20. package/dist/builders/manifest-builder.js +19 -0
  21. package/dist/builders/manifest-builder.js.map +1 -0
  22. package/dist/builders/mdx-builder.d.ts +6 -0
  23. package/dist/builders/mdx-builder.d.ts.map +1 -0
  24. package/dist/builders/mdx-builder.js +40 -0
  25. package/dist/builders/mdx-builder.js.map +1 -0
  26. package/dist/builders/seo-builder.d.ts +6 -0
  27. package/dist/builders/seo-builder.d.ts.map +1 -0
  28. package/dist/builders/seo-builder.js +19 -0
  29. package/dist/builders/seo-builder.js.map +1 -0
  30. package/dist/builders/types-builder.d.ts +6 -0
  31. package/dist/builders/types-builder.d.ts.map +1 -0
  32. package/dist/builders/types-builder.js +18 -0
  33. package/dist/builders/types-builder.js.map +1 -0
  34. package/dist/cache/build-cache.d.ts +41 -0
  35. package/dist/cache/build-cache.d.ts.map +1 -0
  36. package/dist/cache/build-cache.js +147 -0
  37. package/dist/cache/build-cache.js.map +1 -0
  38. package/dist/cache/index.d.ts +5 -0
  39. package/dist/cache/index.d.ts.map +1 -0
  40. package/dist/cache/index.js +5 -0
  41. package/dist/cache/index.js.map +1 -0
  42. package/dist/generators/index.d.ts +8 -0
  43. package/dist/generators/index.d.ts.map +1 -0
  44. package/dist/generators/index.js +8 -0
  45. package/dist/generators/index.js.map +1 -0
  46. package/dist/generators/robots.d.ts +5 -0
  47. package/dist/generators/robots.d.ts.map +1 -0
  48. package/dist/generators/robots.js +34 -0
  49. package/dist/generators/robots.js.map +1 -0
  50. package/dist/generators/routes.d.ts +6 -0
  51. package/dist/generators/routes.d.ts.map +1 -0
  52. package/dist/generators/routes.js +77 -0
  53. package/dist/generators/routes.js.map +1 -0
  54. package/dist/generators/search.d.ts +6 -0
  55. package/dist/generators/search.d.ts.map +1 -0
  56. package/dist/generators/search.js +44 -0
  57. package/dist/generators/search.js.map +1 -0
  58. package/dist/generators/sitemap.d.ts +6 -0
  59. package/dist/generators/sitemap.d.ts.map +1 -0
  60. package/dist/generators/sitemap.js +33 -0
  61. package/dist/generators/sitemap.js.map +1 -0
  62. package/dist/index.d.ts +19 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +27 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/parsers/filter-props.d.ts +15 -0
  67. package/dist/parsers/filter-props.d.ts.map +1 -0
  68. package/dist/parsers/filter-props.js +50 -0
  69. package/dist/parsers/filter-props.js.map +1 -0
  70. package/dist/parsers/index.d.ts +8 -0
  71. package/dist/parsers/index.d.ts.map +1 -0
  72. package/dist/parsers/index.js +8 -0
  73. package/dist/parsers/index.js.map +1 -0
  74. package/dist/parsers/parse-mdx.d.ts +20 -0
  75. package/dist/parsers/parse-mdx.d.ts.map +1 -0
  76. package/dist/parsers/parse-mdx.js +172 -0
  77. package/dist/parsers/parse-mdx.js.map +1 -0
  78. package/dist/parsers/parse-types.d.ts +24 -0
  79. package/dist/parsers/parse-types.d.ts.map +1 -0
  80. package/dist/parsers/parse-types.js +83 -0
  81. package/dist/parsers/parse-types.js.map +1 -0
  82. package/dist/parsers/process-types.d.ts +19 -0
  83. package/dist/parsers/process-types.d.ts.map +1 -0
  84. package/dist/parsers/process-types.js +44 -0
  85. package/dist/parsers/process-types.js.map +1 -0
  86. package/dist/schemas/index.d.ts +6 -0
  87. package/dist/schemas/index.d.ts.map +1 -0
  88. package/dist/schemas/index.js +6 -0
  89. package/dist/schemas/index.js.map +1 -0
  90. package/dist/schemas/lifecycle-states.d.ts +16 -0
  91. package/dist/schemas/lifecycle-states.d.ts.map +1 -0
  92. package/dist/schemas/lifecycle-states.js +50 -0
  93. package/dist/schemas/lifecycle-states.js.map +1 -0
  94. package/dist/schemas/mdx-document.d.ts +233 -0
  95. package/dist/schemas/mdx-document.d.ts.map +1 -0
  96. package/dist/schemas/mdx-document.js +118 -0
  97. package/dist/schemas/mdx-document.js.map +1 -0
  98. package/dist/types/config.d.ts +106 -0
  99. package/dist/types/config.d.ts.map +1 -0
  100. package/dist/types/config.js +2 -0
  101. package/dist/types/config.js.map +1 -0
  102. package/dist/types/index.d.ts +7 -0
  103. package/dist/types/index.d.ts.map +1 -0
  104. package/dist/types/index.js +6 -0
  105. package/dist/types/index.js.map +1 -0
  106. package/dist/types/mdx.d.ts +16 -0
  107. package/dist/types/mdx.d.ts.map +1 -0
  108. package/dist/types/mdx.js +2 -0
  109. package/dist/types/mdx.js.map +1 -0
  110. package/dist/utils/file-utils.d.ts +28 -0
  111. package/dist/utils/file-utils.d.ts.map +1 -0
  112. package/dist/utils/file-utils.js +111 -0
  113. package/dist/utils/file-utils.js.map +1 -0
  114. package/dist/utils/index.d.ts +8 -0
  115. package/dist/utils/index.d.ts.map +1 -0
  116. package/dist/utils/index.js +8 -0
  117. package/dist/utils/index.js.map +1 -0
  118. package/dist/utils/logger.d.ts +8 -0
  119. package/dist/utils/logger.d.ts.map +1 -0
  120. package/dist/utils/logger.js +16 -0
  121. package/dist/utils/logger.js.map +1 -0
  122. package/dist/utils/sluggify.d.ts +17 -0
  123. package/dist/utils/sluggify.d.ts.map +1 -0
  124. package/dist/utils/sluggify.js +26 -0
  125. package/dist/utils/sluggify.js.map +1 -0
  126. package/dist/utils/validate-file-path.d.ts +23 -0
  127. package/dist/utils/validate-file-path.d.ts.map +1 -0
  128. package/dist/utils/validate-file-path.js +39 -0
  129. package/dist/utils/validate-file-path.js.map +1 -0
  130. package/dist/validation/index.d.ts +5 -0
  131. package/dist/validation/index.d.ts.map +1 -0
  132. package/dist/validation/index.js +5 -0
  133. package/dist/validation/index.js.map +1 -0
  134. package/dist/validation/validate-content.d.ts +12 -0
  135. package/dist/validation/validate-content.d.ts.map +1 -0
  136. package/dist/validation/validate-content.js +95 -0
  137. package/dist/validation/validate-content.js.map +1 -0
  138. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # @commercetools/nimbus-docs-build
2
+
3
+ Documentation build system for the Nimbus design system. This package handles:
4
+
5
+ - **MDX Parsing**: Extracts frontmatter, generates table of contents, supports multi-view documentation
6
+ - **TypeScript Type Extraction**: Parses component props using react-docgen-typescript
7
+ - **Route Generation**: Creates route manifests for documentation navigation
8
+ - **Search Index**: Generates searchable documentation index
9
+ - **Build Caching**: Incremental builds with file hashing
10
+ - **Content Validation**: Validates documentation structure and content
11
+ - **Asset Optimization**: Optimizes images and static assets
12
+ - **SEO Generation**: Creates robots.txt and sitemap.xml
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add -D @commercetools/nimbus-docs-build
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Configuration
23
+
24
+ Create a `docs-build.config.ts` file:
25
+
26
+ ```typescript
27
+ import { defineConfig } from '@commercetools/nimbus-docs-build';
28
+
29
+ export default defineConfig({
30
+ sources: {
31
+ packagesDir: './packages',
32
+ componentIndexPath: './packages/nimbus/src/index.ts',
33
+ },
34
+ output: {
35
+ routesDir: './src/data/routes',
36
+ manifestPath: './src/data/route-manifest.json',
37
+ searchIndexPath: './src/data/search-index.json',
38
+ typesDir: './public/generated/types',
39
+ },
40
+ cache: {
41
+ enabled: true,
42
+ },
43
+ seo: {
44
+ baseUrl: 'https://nimbus.commercetools.com',
45
+ generateRobots: true,
46
+ generateSitemap: true,
47
+ },
48
+ });
49
+ ```
50
+
51
+ ### Programmatic API
52
+
53
+ ```typescript
54
+ import { build } from '@commercetools/nimbus-docs-build';
55
+
56
+ const result = await build({
57
+ sources: {
58
+ packagesDir: './packages',
59
+ },
60
+ output: {
61
+ routesDir: './dist/routes',
62
+ manifestPath: './dist/manifest.json',
63
+ searchIndexPath: './dist/search.json',
64
+ typesDir: './dist/types',
65
+ },
66
+ });
67
+
68
+ console.log(`Built ${result.routeCount} routes`);
69
+ ```
70
+
71
+ ### Individual Builders
72
+
73
+ ```typescript
74
+ import {
75
+ parseMdx,
76
+ parseTypes,
77
+ generateRouteManifest,
78
+ } from '@commercetools/nimbus-docs-build';
79
+
80
+ // Parse a single MDX file
81
+ const doc = await parseMdx('./path/to/file.mdx');
82
+
83
+ // Extract TypeScript types
84
+ await parseTypes({
85
+ componentIndexPath: './src/index.ts',
86
+ outputPath: './dist/types.json',
87
+ });
88
+
89
+ // Generate route manifest
90
+ await generateRouteManifest(docs, './dist/manifest.json');
91
+ ```
92
+
93
+ ## Features
94
+
95
+ ### Multi-View Documentation
96
+
97
+ Supports multiple views for a single documentation page:
98
+
99
+ - `button.mdx` - Main documentation (overview)
100
+ - `button.dev.mdx` - Developer-specific view
101
+ - `button.api.mdx` - API reference view
102
+
103
+ ### Incremental Builds
104
+
105
+ Uses file hashing to skip unchanged files, dramatically improving build times.
106
+
107
+ ### Content Validation
108
+
109
+ Validates:
110
+ - Required frontmatter fields
111
+ - Menu structure
112
+ - Content presence
113
+ - Internal links
114
+
115
+ ### TypeScript Type Extraction
116
+
117
+ Automatically extracts and filters component props:
118
+ - Filters out HTML attributes
119
+ - Filters out Chakra system props
120
+ - Filters out React internals
121
+ - Enriches with JSDoc metadata
122
+
123
+ ## Configuration Options
124
+
125
+ See TypeScript definitions for complete configuration options.
126
+
127
+ ## License
128
+
129
+ MIT
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Asset optimization exports
3
+ */
4
+ export * from "./optimize-assets.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Asset optimization exports
3
+ */
4
+ export * from "./optimize-assets.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copy and optimize images from packages to docs
3
+ */
4
+ export declare function optimizeAssets(sourceDir: string, outputDir: string, imageExtensions?: string[]): Promise<void>;
5
+ //# sourceMappingURL=optimize-assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimize-assets.d.ts","sourceRoot":"","sources":["../../src/assets/optimize-assets.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,eAAe,GAAE,MAAM,EAAuD,GAC7E,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Asset Optimization
3
+ *
4
+ * Optimizes images and other static assets for documentation
5
+ */
6
+ import fs from "fs/promises";
7
+ import path from "path";
8
+ import { findFilesByExtensions } from "../utils/file-utils.js";
9
+ import { flog } from "../utils/logger.js";
10
+ /**
11
+ * Copy and optimize images from packages to docs
12
+ */
13
+ export async function optimizeAssets(sourceDir, outputDir, imageExtensions = [".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp"]) {
14
+ try {
15
+ // Ensure output directory exists
16
+ await fs.mkdir(outputDir, { recursive: true });
17
+ // Find all image files
18
+ const images = await findFilesByExtensions(sourceDir, imageExtensions);
19
+ flog(`[Assets] Found ${images.length} images to process`);
20
+ // Copy images to output directory
21
+ for (const imagePath of images) {
22
+ const relativePath = path.relative(sourceDir, imagePath);
23
+ const outputPath = path.join(outputDir, relativePath);
24
+ // Ensure output directory exists
25
+ await fs.mkdir(path.dirname(outputPath), { recursive: true });
26
+ // Copy file
27
+ await fs.copyFile(imagePath, outputPath);
28
+ }
29
+ flog(`[Assets] Optimized ${images.length} assets`);
30
+ }
31
+ catch (error) {
32
+ console.error("Error optimizing assets:", error);
33
+ throw error;
34
+ }
35
+ }
36
+ //# sourceMappingURL=optimize-assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimize-assets.js","sourceRoot":"","sources":["../../src/assets/optimize-assets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,SAAiB,EACjB,SAAiB,EACjB,kBAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;IAE9E,IAAI,CAAC;QACH,iCAAiC;QACjC,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,uBAAuB;QACvB,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAEvE,IAAI,CAAC,kBAAkB,MAAM,CAAC,MAAM,oBAAoB,CAAC,CAAC;QAE1D,kCAAkC;QAClC,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE,CAAC;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACzD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YAEtD,iCAAiC;YACjC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE9D,YAAY;YACZ,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,sBAAsB,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DocsBuilderConfig, BuildResult } from "../types/config.js";
2
+ /**
3
+ * Main build function
4
+ */
5
+ export declare function build(config: DocsBuilderConfig): Promise<BuildResult>;
6
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/builders/build.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGzE;;GAEG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CA+E3E"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Main Documentation Build Orchestrator
3
+ *
4
+ * Coordinates the entire documentation build process with optional caching
5
+ */
6
+ import { performance } from "perf_hooks";
7
+ import { validateContent } from "../validation/validate-content.js";
8
+ import { optimizeAssets } from "../assets/optimize-assets.js";
9
+ import { buildMdx } from "./mdx-builder.js";
10
+ import { buildTypes } from "./types-builder.js";
11
+ import { buildManifest } from "./manifest-builder.js";
12
+ import { buildSeo } from "./seo-builder.js";
13
+ import { flog, successLog } from "../utils/logger.js";
14
+ /**
15
+ * Main build function
16
+ */
17
+ export async function build(config) {
18
+ const startTime = performance.now();
19
+ console.log("\n🚀 Starting documentation build...\n");
20
+ try {
21
+ // Step 1-2: Parse MDX files and write per-route JSON
22
+ const docs = await buildMdx(config.sources.packagesDir, config.output.routesDir);
23
+ // Step 3: Validate content
24
+ if (config.validation?.enabled !== false) {
25
+ flog("[3/6] Validating content...");
26
+ const errors = validateContent(docs);
27
+ const errorCount = errors.filter((e) => e.severity === "error").length;
28
+ if (errorCount > 0 && config.validation?.strict) {
29
+ throw new Error("Content validation failed");
30
+ }
31
+ }
32
+ // Step 4: Generate route manifest and search index
33
+ const manifest = await buildManifest(docs, config.output.manifestPath, config.output.searchIndexPath);
34
+ // Step 5: Parse TypeScript types
35
+ let componentCount = 0;
36
+ if (config.sources.componentIndexPath) {
37
+ componentCount = await buildTypes(config.sources.componentIndexPath, config.output.typesDir, config.propFilter);
38
+ }
39
+ // Step 6: Optimize assets
40
+ if (config.output.assetsDir && config.assets?.enabled !== false) {
41
+ flog("[6/6] Optimizing assets...");
42
+ await optimizeAssets(config.sources.packagesDir, config.output.assetsDir, config.assets?.imageExtensions);
43
+ }
44
+ // Optional: Generate SEO files
45
+ if (config.seo?.baseUrl) {
46
+ await buildSeo(manifest, config.seo.baseUrl, config.seo.generateRobots ? config.output.robotsPath : undefined, config.seo.generateSitemap ? config.output.sitemapPath : undefined);
47
+ }
48
+ const endTime = performance.now();
49
+ const duration = endTime - startTime;
50
+ successLog(`Documentation build completed in ${(duration / 1000).toFixed(2)}s ✨`);
51
+ return {
52
+ routeCount: docs.size,
53
+ componentCount,
54
+ duration,
55
+ cacheUsed: false,
56
+ filesRebuilt: docs.size,
57
+ filesCached: 0,
58
+ };
59
+ }
60
+ catch (error) {
61
+ console.error("\n❌ Build failed:", error);
62
+ throw error;
63
+ }
64
+ }
65
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/builders/build.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Builder exports
3
+ */
4
+ export * from "./mdx-builder.js";
5
+ export * from "./types-builder.js";
6
+ export * from "./manifest-builder.js";
7
+ export * from "./seo-builder.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Builder exports
3
+ */
4
+ export * from "./mdx-builder.js";
5
+ export * from "./types-builder.js";
6
+ export * from "./manifest-builder.js";
7
+ export * from "./seo-builder.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { MdxDocument, RouteManifest } from "../types/mdx.js";
2
+ /**
3
+ * Build route manifest and search index
4
+ */
5
+ export declare function buildManifest(docs: Map<string, MdxDocument>, manifestPath: string, searchIndexPath: string): Promise<RouteManifest>;
6
+ //# sourceMappingURL=manifest-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-builder.d.ts","sourceRoot":"","sources":["../../src/builders/manifest-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGlE;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAC9B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CAQxB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Manifest Builder
3
+ *
4
+ * Generates route manifest and search index
5
+ */
6
+ import { generateRouteManifest } from "../generators/routes.js";
7
+ import { generateSearchIndex } from "../generators/search.js";
8
+ import { flog } from "../utils/logger.js";
9
+ /**
10
+ * Build route manifest and search index
11
+ */
12
+ export async function buildManifest(docs, manifestPath, searchIndexPath) {
13
+ flog("[4/6] Generating route manifest...");
14
+ const manifest = await generateRouteManifest(docs, manifestPath);
15
+ flog("[4/6] Generating search index...");
16
+ await generateSearchIndex(docs, searchIndexPath);
17
+ return manifest;
18
+ }
19
+ //# sourceMappingURL=manifest-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-builder.js","sourceRoot":"","sources":["../../src/builders/manifest-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAA8B,EAC9B,YAAoB,EACpB,eAAuB;IAEvB,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEjE,IAAI,CAAC,kCAAkC,CAAC,CAAC;IACzC,MAAM,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAEjD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { MdxDocument } from "../types/mdx.js";
2
+ /**
3
+ * Build MDX documentation
4
+ */
5
+ export declare function buildMdx(packagesDir: string, routesOutputDir: string): Promise<Map<string, MdxDocument>>;
6
+ //# sourceMappingURL=mdx-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-builder.d.ts","sourceRoot":"","sources":["../../src/builders/mdx-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA0BnD;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAanC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * MDX Builder
3
+ *
4
+ * Handles MDX file discovery, parsing, and per-route JSON generation
5
+ */
6
+ import fs from "fs/promises";
7
+ import { parseAllMdx } from "../parsers/parse-mdx.js";
8
+ import { flog } from "../utils/logger.js";
9
+ import { findFiles } from "../utils/file-utils.js";
10
+ import { validateFilePath } from "../utils/validate-file-path.js";
11
+ /**
12
+ * Write per-route JSON files for all documents
13
+ */
14
+ async function writeRouteFiles(docs, outputDir) {
15
+ // Ensure output directory exists
16
+ await fs.mkdir(outputDir, { recursive: true });
17
+ // Write per-route JSON files
18
+ for (const [, doc] of docs) {
19
+ // Use route field (derived from menu path) for consistent filenames across the system
20
+ const routeId = doc.meta.route.replace(/\//g, "-");
21
+ const outputPath = validateFilePath(outputDir, `${routeId}.json`);
22
+ // Write per-route JSON
23
+ await fs.writeFile(outputPath, JSON.stringify(doc, null, 2));
24
+ }
25
+ }
26
+ /**
27
+ * Build MDX documentation
28
+ */
29
+ export async function buildMdx(packagesDir, routesOutputDir) {
30
+ flog("[1/6] Finding MDX files...");
31
+ const mdxFiles = await findFiles(packagesDir, ".mdx");
32
+ flog(`Found ${mdxFiles.length} MDX files`);
33
+ flog("[2/6] Parsing MDX files...");
34
+ const docs = await parseAllMdx(mdxFiles);
35
+ flog(`[MDX] Parsed ${docs.size} documentation files`);
36
+ // Write per-route JSON files
37
+ await writeRouteFiles(docs, routesOutputDir);
38
+ return docs;
39
+ }
40
+ //# sourceMappingURL=mdx-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-builder.js","sourceRoot":"","sources":["../../src/builders/mdx-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;GAEG;AACH,KAAK,UAAU,eAAe,CAC5B,IAA8B,EAC9B,SAAiB;IAEjB,iCAAiC;IACjC,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/C,6BAA6B;IAC7B,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,sFAAsF;QACtF,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,EAAE,GAAG,OAAO,OAAO,CAAC,CAAC;QAElE,uBAAuB;QACvB,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,WAAmB,EACnB,eAAuB;IAEvB,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,YAAY,CAAC,CAAC;IAE3C,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,sBAAsB,CAAC,CAAC;IAEtD,6BAA6B;IAC7B,MAAM,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAE7C,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { RouteManifest } from "../types/mdx.js";
2
+ /**
3
+ * Build SEO files
4
+ */
5
+ export declare function buildSeo(manifest: RouteManifest, baseUrl: string, robotsPath?: string, sitemapPath?: string): Promise<void>;
6
+ //# sourceMappingURL=seo-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seo-builder.d.ts","sourceRoot":"","sources":["../../src/builders/seo-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * SEO Builder
3
+ *
4
+ * Generates SEO files (robots.txt, sitemap.xml)
5
+ */
6
+ import { generateRobots } from "../generators/robots.js";
7
+ import { generateSitemap } from "../generators/sitemap.js";
8
+ /**
9
+ * Build SEO files
10
+ */
11
+ export async function buildSeo(manifest, baseUrl, robotsPath, sitemapPath) {
12
+ if (robotsPath) {
13
+ await generateRobots(baseUrl, robotsPath);
14
+ }
15
+ if (sitemapPath) {
16
+ await generateSitemap(manifest, baseUrl, sitemapPath);
17
+ }
18
+ }
19
+ //# sourceMappingURL=seo-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seo-builder.js","sourceRoot":"","sources":["../../src/builders/seo-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,QAAuB,EACvB,OAAe,EACf,UAAmB,EACnB,WAAoB;IAEpB,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DocsBuilderConfig } from "../types/config.js";
2
+ /**
3
+ * Build TypeScript component types
4
+ */
5
+ export declare function buildTypes(componentIndexPath: string, typesOutputDir: string, propFilter?: DocsBuilderConfig["propFilter"]): Promise<number>;
6
+ //# sourceMappingURL=types-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-builder.d.ts","sourceRoot":"","sources":["../../src/builders/types-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,wBAAsB,UAAU,CAC9B,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAajB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Types Builder
3
+ *
4
+ * Handles TypeScript type extraction and generation
5
+ */
6
+ import { parseTypesToFiles } from "../parsers/parse-types.js";
7
+ import { flog } from "../utils/logger.js";
8
+ /**
9
+ * Build TypeScript component types
10
+ */
11
+ export async function buildTypes(componentIndexPath, typesOutputDir, propFilter) {
12
+ flog("[5/6] Parsing TypeScript types...");
13
+ const manifest = await parseTypesToFiles(componentIndexPath, typesOutputDir, propFilter);
14
+ const componentCount = Object.keys(manifest).length;
15
+ flog(`[TSX] Parsed ${componentCount} component types`);
16
+ return componentCount;
17
+ }
18
+ //# sourceMappingURL=types-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-builder.js","sourceRoot":"","sources":["../../src/builders/types-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,kBAA0B,EAC1B,cAAsB,EACtB,UAA4C;IAE5C,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CACtC,kBAAkB,EAClB,cAAc,EACd,UAAU,CACX,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IACpD,IAAI,CAAC,gBAAgB,cAAc,kBAAkB,CAAC,CAAC;IAEvD,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { BuildCache } from "../types/config.js";
2
+ /**
3
+ * Calculate file hash for cache validation
4
+ *
5
+ * @param filePath - Absolute path to file (should be pre-validated by caller)
6
+ * @note Callers must ensure filePath is validated to prevent path traversal
7
+ */
8
+ export declare function calculateFileHash(filePath: string): Promise<string>;
9
+ /**
10
+ * Load build cache from disk
11
+ */
12
+ export declare function loadCache(cacheDir?: string): Promise<BuildCache>;
13
+ /**
14
+ * Save build cache to disk
15
+ */
16
+ export declare function saveCache(cache: BuildCache, cacheDir?: string): Promise<void>;
17
+ /**
18
+ * Check if a file needs rebuilding
19
+ */
20
+ export declare function needsRebuild(filePath: string, cache: BuildCache): Promise<boolean>;
21
+ /**
22
+ * Update cache entry for a file
23
+ */
24
+ export declare function updateCacheEntry(cache: BuildCache, filePath: string, hash: string, outputPath: string): void;
25
+ /**
26
+ * Clear stale cache entries (files that no longer exist)
27
+ */
28
+ export declare function cleanCache(cache: BuildCache, validFiles: string[]): Promise<void>;
29
+ /**
30
+ * Get cache statistics
31
+ */
32
+ export declare function getCacheStats(cache: BuildCache): {
33
+ totalFiles: number;
34
+ oldestEntry: number;
35
+ newestEntry: number;
36
+ };
37
+ /**
38
+ * Clear entire cache
39
+ */
40
+ export declare function clearCache(cacheDir?: string): Promise<void>;
41
+ //# sourceMappingURL=build-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-cache.d.ts","sourceRoot":"","sources":["../../src/cache/build-cache.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBrD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGzE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAoBtE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAcA;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjE"}