@mui/internal-docs-infra 0.2.3-canary.9 → 0.3.1-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +3 -2
  2. package/esm/CodeHighlighter/CodeHighlighter.js +16 -16
  3. package/esm/CodeHighlighter/CodeHighlighterClient.js +33 -33
  4. package/esm/CodeHighlighter/errors.js +3 -3
  5. package/esm/CodeHighlighter/types.d.ts +1 -1
  6. package/esm/CodeProvider/CodeContext.d.ts +4 -4
  7. package/esm/CodeProvider/CodeProvider.js +7 -7
  8. package/esm/cli/index.d.ts +1 -0
  9. package/esm/cli/index.js +6 -0
  10. package/esm/cli/runValidate.d.ts +8 -0
  11. package/esm/cli/runValidate.js +297 -0
  12. package/esm/createSitemap/createSitemap.d.ts +23 -0
  13. package/esm/createSitemap/createSitemap.js +45 -0
  14. package/esm/createSitemap/index.d.ts +1 -0
  15. package/esm/createSitemap/index.js +1 -0
  16. package/esm/createSitemap/types.d.ts +68 -0
  17. package/esm/createSitemap/types.js +1 -0
  18. package/esm/pipeline/getFileConventions/fileConventions.d.ts +4 -0
  19. package/esm/pipeline/getFileConventions/fileConventions.js +4 -0
  20. package/esm/pipeline/getFileConventions/getFileConventions.d.ts +4 -0
  21. package/esm/pipeline/getFileConventions/getFileConventions.js +17 -0
  22. package/esm/pipeline/getFileConventions/index.d.ts +1 -0
  23. package/esm/pipeline/getFileConventions/index.js +1 -0
  24. package/esm/{CodeHighlighter/addPathsToVariant.d.ts → pipeline/loadCodeVariant/addCodeVariantPaths.d.ts} +1 -1
  25. package/esm/{CodeHighlighter/applyTransform.d.ts → pipeline/loadCodeVariant/applyCodeTransform.d.ts} +3 -3
  26. package/esm/{CodeHighlighter/applyTransform.js → pipeline/loadCodeVariant/applyCodeTransform.js} +4 -4
  27. package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.js +1 -1
  28. package/esm/{CodeHighlighter/transformCode.d.ts → pipeline/loadCodeVariant/computeHastDeltas.d.ts} +9 -5
  29. package/esm/{CodeHighlighter/transformCode.js → pipeline/loadCodeVariant/computeHastDeltas.js} +20 -16
  30. package/esm/pipeline/loadCodeVariant/diffHast.d.ts +3 -0
  31. package/esm/{CodeHighlighter/transformParsedSource.js → pipeline/loadCodeVariant/diffHast.js} +5 -5
  32. package/esm/{CodeHighlighter/examineVariant.d.ts → pipeline/loadCodeVariant/examineCodeVariant.d.ts} +2 -2
  33. package/esm/{CodeHighlighter/examineVariant.js → pipeline/loadCodeVariant/examineCodeVariant.js} +1 -1
  34. package/esm/{useDemo/flattenVariant.d.ts → pipeline/loadCodeVariant/flattenCodeVariant.d.ts} +2 -2
  35. package/esm/{useDemo/flattenVariant.js → pipeline/loadCodeVariant/flattenCodeVariant.js} +3 -3
  36. package/esm/{CodeHighlighter/hasAllVariants.d.ts → pipeline/loadCodeVariant/hasAllCodeVariants.d.ts} +1 -1
  37. package/esm/pipeline/loadCodeVariant/index.d.ts +10 -0
  38. package/esm/pipeline/loadCodeVariant/index.js +17 -0
  39. package/esm/{CodeHighlighter/loadFallbackCode.d.ts → pipeline/loadCodeVariant/loadCodeFallback.d.ts} +2 -2
  40. package/esm/{CodeHighlighter/loadFallbackCode.js → pipeline/loadCodeVariant/loadCodeFallback.js} +180 -106
  41. package/esm/{CodeHighlighter/loadVariant.d.ts → pipeline/loadCodeVariant/loadCodeVariant.d.ts} +2 -2
  42. package/esm/{CodeHighlighter/loadVariant.js → pipeline/loadCodeVariant/loadCodeVariant.js} +141 -55
  43. package/esm/{CodeHighlighter/maybeInitialData.d.ts → pipeline/loadCodeVariant/maybeCodeInitialData.d.ts} +6 -6
  44. package/esm/{CodeHighlighter/maybeInitialData.js → pipeline/loadCodeVariant/maybeCodeInitialData.js} +6 -6
  45. package/esm/{CodeHighlighter/mergeMetadata.d.ts → pipeline/loadCodeVariant/mergeCodeMetadata.d.ts} +3 -3
  46. package/esm/{CodeHighlighter/mergeMetadata.js → pipeline/loadCodeVariant/mergeCodeMetadata.js} +3 -3
  47. package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.d.ts +1 -1
  48. package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.d.ts +1 -1
  49. package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +5 -0
  50. package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +94 -16
  51. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +3 -3
  52. package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.d.ts +30 -0
  53. package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.js +77 -0
  54. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +24 -14
  55. package/esm/pipeline/loadPrecomputedSitemap/index.d.ts +2 -0
  56. package/esm/pipeline/loadPrecomputedSitemap/index.js +4 -0
  57. package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.d.ts +10 -0
  58. package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.js +220 -0
  59. package/esm/pipeline/loadServerCodeMeta/index.d.ts +2 -1
  60. package/esm/pipeline/loadServerCodeMeta/index.js +2 -1
  61. package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts +1 -1
  62. package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +7 -5
  63. package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.d.ts +3 -3
  64. package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.js +14 -8
  65. package/esm/pipeline/loadServerPageIndex/index.d.ts +2 -0
  66. package/esm/pipeline/loadServerPageIndex/index.js +1 -0
  67. package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.d.ts +51 -0
  68. package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.js +176 -0
  69. package/esm/pipeline/loadServerSitemap/index.d.ts +2 -0
  70. package/esm/pipeline/loadServerSitemap/index.js +1 -0
  71. package/esm/pipeline/loadServerSitemap/loadServerSitemap.d.ts +39 -0
  72. package/esm/pipeline/loadServerSitemap/loadServerSitemap.js +170 -0
  73. package/esm/pipeline/loadServerSource/loadServerSource.js +18 -15
  74. package/esm/pipeline/loaderUtils/externalsToPackages.js +1 -1
  75. package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +0 -9
  76. package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +7 -7
  77. package/esm/pipeline/loaderUtils/fileUrlToPortablePath.d.ts +44 -0
  78. package/esm/pipeline/loaderUtils/fileUrlToPortablePath.js +80 -0
  79. package/esm/pipeline/loaderUtils/index.d.ts +2 -1
  80. package/esm/pipeline/loaderUtils/index.js +2 -1
  81. package/esm/pipeline/loaderUtils/parseImportsAndComments.d.ts +10 -6
  82. package/esm/pipeline/loaderUtils/parseImportsAndComments.js +17 -12
  83. package/esm/pipeline/loaderUtils/processRelativeImports.d.ts +1 -1
  84. package/esm/pipeline/loaderUtils/processRelativeImports.js +44 -27
  85. package/esm/pipeline/loaderUtils/resolveModulePath.d.ts +5 -5
  86. package/esm/pipeline/loaderUtils/resolveModulePath.js +40 -37
  87. package/esm/pipeline/loaderUtils/rewriteImports.d.ts +36 -0
  88. package/esm/pipeline/loaderUtils/rewriteImports.js +139 -8
  89. package/esm/pipeline/syncPageIndex/createMarkdownNodes.d.ts +76 -0
  90. package/esm/pipeline/syncPageIndex/createMarkdownNodes.js +305 -0
  91. package/esm/pipeline/syncPageIndex/index.d.ts +1 -0
  92. package/esm/pipeline/syncPageIndex/index.js +1 -0
  93. package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.d.ts +58 -0
  94. package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.js +214 -0
  95. package/esm/pipeline/syncPageIndex/metadataToMarkdown.d.ts +67 -0
  96. package/esm/pipeline/syncPageIndex/metadataToMarkdown.js +1486 -0
  97. package/esm/pipeline/syncPageIndex/syncPageIndex.d.ts +108 -0
  98. package/esm/pipeline/syncPageIndex/syncPageIndex.js +540 -0
  99. package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.d.ts +2 -2
  100. package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.js +5 -5
  101. package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.d.ts +2 -0
  102. package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.js +4 -0
  103. package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.d.ts +16 -0
  104. package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.js +58 -0
  105. package/esm/pipeline/transformMarkdownDemoLinks/index.d.ts +2 -0
  106. package/esm/pipeline/transformMarkdownDemoLinks/index.js +4 -0
  107. package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.d.ts +26 -0
  108. package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.js +107 -0
  109. package/esm/pipeline/transformMarkdownMetadata/index.d.ts +2 -0
  110. package/esm/pipeline/transformMarkdownMetadata/index.js +4 -0
  111. package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.d.ts +3 -0
  112. package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.js +1010 -0
  113. package/esm/pipeline/transformMarkdownMetadata/types.d.ts +110 -0
  114. package/esm/pipeline/transformMarkdownMetadata/types.js +1 -0
  115. package/esm/pipeline/transformMarkdownRelativePaths/index.d.ts +2 -0
  116. package/esm/pipeline/transformMarkdownRelativePaths/index.js +4 -0
  117. package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.d.ts +15 -0
  118. package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.js +43 -0
  119. package/esm/useCode/Pre.js +15 -2
  120. package/esm/useCode/useCode.d.ts +15 -2
  121. package/esm/useCode/useCode.js +15 -6
  122. package/esm/useCode/useCodeUtils.js +3 -3
  123. package/esm/useCode/useFileNavigation.d.ts +9 -3
  124. package/esm/useCode/useFileNavigation.js +124 -81
  125. package/esm/useCode/useUIState.d.ts +4 -1
  126. package/esm/useCode/useUIState.js +17 -2
  127. package/esm/useCode/useVariantSelection.d.ts +8 -3
  128. package/esm/useCode/useVariantSelection.js +144 -52
  129. package/esm/useCopier/index.js +5 -4
  130. package/esm/useDemo/createCodeSandbox.d.ts +1 -1
  131. package/esm/useDemo/createStackBlitz.d.ts +1 -1
  132. package/esm/useDemo/exportVariant.js +13 -11
  133. package/esm/useDemo/index.d.ts +1 -1
  134. package/esm/useDemo/index.js +1 -1
  135. package/esm/useDemo/useDemo.d.ts +5 -5
  136. package/esm/useDemo/useDemo.js +6 -6
  137. package/esm/useErrors/useErrors.d.ts +1 -1
  138. package/esm/useErrors/useErrors.js +6 -2
  139. package/esm/useSearch/index.d.ts +1 -0
  140. package/esm/useSearch/index.js +1 -0
  141. package/esm/useSearch/types.d.ts +165 -0
  142. package/esm/useSearch/types.js +1 -0
  143. package/esm/useSearch/useSearch.d.ts +56 -0
  144. package/esm/useSearch/useSearch.js +647 -0
  145. package/esm/withDocsInfra/withDeploymentConfig.js +4 -2
  146. package/esm/withDocsInfra/withDocsInfra.d.ts +39 -0
  147. package/esm/withDocsInfra/withDocsInfra.js +94 -14
  148. package/package.json +105 -5
  149. package/esm/CodeHighlighter/transformParsedSource.d.ts +0 -3
  150. /package/esm/{CodeHighlighter/addPathsToVariant.js → pipeline/loadCodeVariant/addCodeVariantPaths.js} +0 -0
  151. /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.d.ts +0 -0
  152. /package/esm/{CodeHighlighter/hasAllVariants.js → pipeline/loadCodeVariant/hasAllCodeVariants.js} +0 -0
  153. /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.js +0 -0
  154. /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.d.ts +0 -0
  155. /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.js +0 -0
  156. /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.js +0 -0
@@ -47,6 +47,14 @@ export interface WithDocsInfraOptions {
47
47
  additionalTurbopackRules?: Record<string, {
48
48
  loaders: string[];
49
49
  }>;
50
+ /**
51
+ * Performance logging options
52
+ */
53
+ performance?: {
54
+ logging: boolean;
55
+ notableMs?: number;
56
+ showWrapperMeasures?: boolean;
57
+ };
50
58
  /**
51
59
  * Defer AST parsing option for code highlighter output.
52
60
  * 'gzip' - Default, outputs gzipped HAST for best performance.
@@ -67,6 +75,37 @@ export interface DocsInfraMdxOptions {
67
75
  * Additional rehype plugins to add to the default docs-infra plugins
68
76
  */
69
77
  additionalRehypePlugins?: Array<string | [string, ...any[]]>;
78
+ /**
79
+ * Whether to automatically extract page metadata (title, description, headings) from MDX files
80
+ * and maintain an index in the parent directory's page.mdx file.
81
+ *
82
+ * Index files themselves (e.g., pattern/page.mdx) are automatically excluded from extraction.
83
+ *
84
+ * Can be:
85
+ * - `false` - Disabled
86
+ * - `true` - Enabled with default filter: `{ include: ['app', 'src/app'], exclude: [] }`
87
+ * - `{ include: string[], exclude: string[] }` - Enabled with custom path filters
88
+ *
89
+ * @default true
90
+ */
91
+ extractToIndex?: boolean | {
92
+ /** Path prefixes that files must match to have metadata extracted */
93
+ include: string[];
94
+ /** Path prefixes to exclude from metadata extraction */
95
+ exclude: string[];
96
+ };
97
+ /**
98
+ * Base directory for path filtering. Defaults to process.cwd().
99
+ * Only needed when calling the plugin directly (not via withDocsInfra).
100
+ */
101
+ baseDir?: string;
102
+ /**
103
+ * Throw an error if any index is out of date or missing.
104
+ * Useful for CI environments to ensure indexes are committed.
105
+ *
106
+ * @default false
107
+ */
108
+ errorIfIndexOutOfDate?: boolean;
70
109
  }
71
110
  /**
72
111
  * Get default MDX options for docs-infra
@@ -1,6 +1,6 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  // Define webpack options interface based on Next.js webpack function signature
5
5
 
6
6
  /**
@@ -9,7 +9,35 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
9
  export function getDocsInfraMdxOptions() {
10
10
  var _customOptions$remark, _customOptions$additi, _customOptions$rehype, _customOptions$additi2;
11
11
  var customOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- var defaultRemarkPlugins = [['remark-gfm'], ['@mui/internal-docs-infra/pipeline/transformMarkdownCode']];
12
+ var _customOptions$extrac = customOptions.extractToIndex,
13
+ extractToIndex = _customOptions$extrac === void 0 ? true : _customOptions$extrac,
14
+ baseDir = customOptions.baseDir,
15
+ _customOptions$errorI = customOptions.errorIfIndexOutOfDate,
16
+ errorIfIndexOutOfDate = _customOptions$errorI === void 0 ? Boolean(process.env.CI) : _customOptions$errorI;
17
+
18
+ // Normalize extractToIndex to options object
19
+ var extractToIndexOptions;
20
+ if (extractToIndex === false) {
21
+ extractToIndexOptions = false;
22
+ } else if (extractToIndex === true) {
23
+ // Default filter: include all files under app/ and src/app/
24
+ // Index files (pattern/page.mdx) are automatically excluded by the matching logic
25
+ // Use process.cwd() as default baseDir (the directory where Next.js is running)
26
+ extractToIndexOptions = {
27
+ include: ['app', 'src/app'],
28
+ exclude: [],
29
+ baseDir: baseDir != null ? baseDir : process.cwd()
30
+ };
31
+ } else {
32
+ extractToIndexOptions = _extends(_extends({}, extractToIndex), {}, {
33
+ baseDir: baseDir != null ? baseDir : process.cwd()
34
+ });
35
+ }
36
+ var defaultRemarkPlugins = [['remark-gfm'], ['@mui/internal-docs-infra/pipeline/transformMarkdownMetadata', {
37
+ extractToIndex: extractToIndexOptions,
38
+ markerPath: '.next/cache/docs-infra/index-updates',
39
+ errorIfIndexOutOfDate: errorIfIndexOutOfDate
40
+ }], ['@mui/internal-docs-infra/pipeline/transformMarkdownRelativePaths'], ['@mui/internal-docs-infra/pipeline/transformMarkdownBlockquoteCallouts'], ['@mui/internal-docs-infra/pipeline/transformMarkdownCode'], ['@mui/internal-docs-infra/pipeline/transformMarkdownDemoLinks']];
13
41
  var defaultRehypePlugins = [['@mui/internal-docs-infra/pipeline/transformHtmlCodePrecomputed']];
14
42
 
15
43
  // Build final plugin arrays
@@ -40,6 +68,8 @@ export function withDocsInfra() {
40
68
  additionalDemoPatterns = _options$additionalDe === void 0 ? {} : _options$additionalDe,
41
69
  _options$additionalTu = options.additionalTurbopackRules,
42
70
  additionalTurbopackRules = _options$additionalTu === void 0 ? {} : _options$additionalTu,
71
+ _options$performance = options.performance,
72
+ performance = _options$performance === void 0 ? {} : _options$performance,
43
73
  _options$deferCodePar = options.deferCodeParsing,
44
74
  deferCodeParsing = _options$deferCodePar === void 0 ? 'gzip' : _options$deferCodePar;
45
75
  var output = 'hastGzip';
@@ -55,15 +85,28 @@ export function withDocsInfra() {
55
85
  var pageExtensions = [].concat(basePageExtensions, _toConsumableArray(additionalPageExtensions));
56
86
 
57
87
  // Build Turbopack rules
58
- var turbopackRules = _defineProperty(_defineProperty({}, demoPathPattern, {
88
+ var turbopackRules = _defineProperty(_defineProperty(_defineProperty({}, demoPathPattern, {
59
89
  loaders: [{
60
90
  loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighter',
61
91
  options: {
92
+ performance: performance,
62
93
  output: output
63
94
  }
64
95
  }]
65
96
  }), clientDemoPathPattern, {
66
- loaders: ['@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient']
97
+ loaders: [{
98
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient',
99
+ options: {
100
+ performance: performance
101
+ }
102
+ }]
103
+ }), './app/sitemap/index.ts', {
104
+ loaders: [{
105
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedSitemap',
106
+ options: {
107
+ performance: performance
108
+ }
109
+ }]
67
110
  });
68
111
 
69
112
  // Add additional demo patterns to Turbopack rules
@@ -73,6 +116,7 @@ export function withDocsInfra() {
73
116
  loaders: [{
74
117
  loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighter',
75
118
  options: {
119
+ performance: performance,
76
120
  output: output
77
121
  }
78
122
  }]
@@ -82,7 +126,12 @@ export function withDocsInfra() {
82
126
  if (additionalDemoPatterns.client) {
83
127
  additionalDemoPatterns.client.forEach(function (pattern) {
84
128
  turbopackRules[pattern] = {
85
- loaders: ['@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient']
129
+ loaders: [{
130
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient',
131
+ options: {
132
+ performance: performance
133
+ }
134
+ }]
86
135
  };
87
136
  });
88
137
  }
@@ -114,10 +163,11 @@ export function withDocsInfra() {
114
163
 
115
164
  // Add loader for demo index files
116
165
  webpackConfig.module.rules.push({
117
- test: new RegExp('/demos/[^/]+/index\\.ts$'),
166
+ test: new RegExp('[/\\\\]demos[/\\\\][^/\\\\]+[/\\\\]index\\.ts$'),
118
167
  use: [defaultLoaders.babel, {
119
168
  loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighter',
120
169
  options: {
170
+ performance: performance,
121
171
  output: output
122
172
  }
123
173
  }]
@@ -125,25 +175,50 @@ export function withDocsInfra() {
125
175
 
126
176
  // Client files for live demos - processes externals
127
177
  webpackConfig.module.rules.push({
128
- test: new RegExp('/demos/[^/]+/client\\.ts$'),
129
- use: [defaultLoaders.babel, '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient']
178
+ test: new RegExp('[/\\\\]demos[/\\\\][^/\\\\]+[/\\\\]client\\.ts$'),
179
+ use: [defaultLoaders.babel, {
180
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient',
181
+ options: {
182
+ performance: performance
183
+ }
184
+ }]
185
+ });
186
+
187
+ // Sitemap loader
188
+ webpackConfig.module.rules.push({
189
+ test: new RegExp('[/\\\\]sitemap[/\\\\]index\\.ts$'),
190
+ use: [defaultLoaders.babel, {
191
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedSitemap',
192
+ options: {
193
+ performance: performance
194
+ }
195
+ }]
130
196
  });
131
197
 
132
198
  // Add webpack rules for additional demo patterns
133
199
  if (additionalDemoPatterns.index) {
134
200
  additionalDemoPatterns.index.forEach(function (pattern) {
135
201
  // Convert Turbopack pattern to webpack regex
136
- var regexPattern = pattern.replace(/^\.\//, '/') // Remove leading ./
202
+ // Pattern like './app/**/demos/*/demo-*/index.ts'
203
+ // Should match paths like '/app/components/demos/Button/demo-variant/index.ts'
204
+ // Use placeholders to avoid corrupting character classes during replacement
205
+ var SEP = 'PATH_SEP_PLACEHOLDER';
206
+ var NOT_SEP = 'NOT_PATH_SEP_PLACEHOLDER';
207
+ var regexPattern = pattern.replace(/^\.\//, '') // Remove leading ./
137
208
  .replace(/\*\*\//g, 'DOUBLE_STAR_PLACEHOLDER') // Replace **/ with placeholder
138
- .replace(/\*/g, '[^/]+') // Replace single * with single dir pattern
209
+ .replace(/\*/g, NOT_SEP) // Replace single * with placeholder
139
210
  .replace(/\./g, '\\.') // Escape dots
140
- .replace(/DOUBLE_STAR_PLACEHOLDER/g, '(?:[^/]+/)*'); // Replace placeholder with zero or more directories
211
+ .replace(/DOUBLE_STAR_PLACEHOLDER/g, "(?:".concat(NOT_SEP).concat(SEP, ")*")) // Replace placeholder with zero or more directories
212
+ .replace(/\//g, SEP) // Convert all path separators to placeholder
213
+ .replace(new RegExp(NOT_SEP, 'g'), '[^/\\\\]+') // Replace NOT_SEP with actual pattern
214
+ .replace(new RegExp(SEP, 'g'), '[/\\\\]'); // Replace SEP with actual pattern
141
215
 
142
216
  webpackConfig.module.rules.push({
143
217
  test: new RegExp("".concat(regexPattern, "$")),
144
218
  use: [defaultLoaders.babel, {
145
219
  loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighter',
146
220
  options: {
221
+ performance: performance,
147
222
  output: output
148
223
  }
149
224
  }]
@@ -155,13 +230,18 @@ export function withDocsInfra() {
155
230
  // Convert Turbopack pattern to webpack regex
156
231
  var regexPattern = pattern.replace(/^\.\//, '/') // Remove leading ./
157
232
  .replace(/\*\*\//g, 'DOUBLE_STAR_PLACEHOLDER') // Replace **/ with placeholder
158
- .replace(/\*/g, '[^/]+') // Replace single * with single dir pattern
233
+ .replace(/\*/g, '[^/\\\\]+') // Replace single * with single dir pattern
159
234
  .replace(/\./g, '\\.') // Escape dots
160
- .replace(/DOUBLE_STAR_PLACEHOLDER/g, '(?:[^/]+/)*'); // Replace placeholder with zero or more directories
235
+ .replace(/DOUBLE_STAR_PLACEHOLDER/g, '(?:[^/\\\\]+/)*'); // Replace placeholder with zero or more directories
161
236
 
162
237
  webpackConfig.module.rules.push({
163
238
  test: new RegExp("".concat(regexPattern, "$")),
164
- use: [defaultLoaders.babel, '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient']
239
+ use: [defaultLoaders.babel, {
240
+ loader: '@mui/internal-docs-infra/pipeline/loadPrecomputedCodeHighlighterClient',
241
+ options: {
242
+ performance: performance
243
+ }
244
+ }]
165
245
  });
166
246
  });
167
247
  }
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@mui/internal-docs-infra",
3
- "version": "0.2.3-canary.9",
3
+ "version": "0.3.1-canary.1",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI Infra - internal documentation creation tools.",
6
+ "bin": {
7
+ "docs-infra": "./esm/cli/index.js"
8
+ },
6
9
  "keywords": [
7
10
  "react",
8
11
  "react-component",
@@ -23,7 +26,12 @@
23
26
  "dependencies": {
24
27
  "@babel/runtime": "^7.28.4",
25
28
  "@babel/standalone": "^7.28.5",
29
+ "@orama/orama": "^3.1.16",
30
+ "@orama/plugin-qps": "^3.1.16",
31
+ "@orama/stemmers": "^3.1.16",
32
+ "@orama/stopwords": "^3.1.16",
26
33
  "@wooorm/starry-night": "^3.8.0",
34
+ "chalk": "^5.6.2",
27
35
  "clipboard-copy": "^4.0.1",
28
36
  "fflate": "^0.8.2",
29
37
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -32,10 +40,12 @@
32
40
  "kebab-case": "^2.0.2",
33
41
  "lz-string": "^1.5.0",
34
42
  "path-module": "^0.1.2",
35
- "prettier": "^3.6.2",
43
+ "prettier": "~3.7.4",
44
+ "proper-lockfile": "^4.1.2",
36
45
  "uint8-to-base64": "^0.2.1",
37
46
  "unist-util-visit": "^5.0.0",
38
- "vscode-oniguruma": "^2.0.1"
47
+ "vscode-oniguruma": "^2.0.1",
48
+ "yargs": "^18.0.0"
39
49
  },
40
50
  "peerDependencies": {
41
51
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -56,7 +66,6 @@
56
66
  "engines": {
57
67
  "node": ">=22.12.0"
58
68
  },
59
- "gitSha": "5e2086fe1de7af3c8403a2052ed42a98b66a4ab9",
60
69
  "type": "commonjs",
61
70
  "exports": {
62
71
  "./package.json": "./package.json",
@@ -120,6 +129,18 @@
120
129
  "default": "./esm/createDemoData/types.js"
121
130
  }
122
131
  },
132
+ "./createSitemap": {
133
+ "default": {
134
+ "types": "./esm/createSitemap/index.d.ts",
135
+ "default": "./esm/createSitemap/index.js"
136
+ }
137
+ },
138
+ "./createSitemap/types": {
139
+ "default": {
140
+ "types": "./esm/createSitemap/types.d.ts",
141
+ "default": "./esm/createSitemap/types.js"
142
+ }
143
+ },
123
144
  "./useCode": {
124
145
  "default": {
125
146
  "types": "./esm/useCode/index.d.ts",
@@ -156,6 +177,18 @@
156
177
  "default": "./esm/usePreference/index.js"
157
178
  }
158
179
  },
180
+ "./useSearch": {
181
+ "default": {
182
+ "types": "./esm/useSearch/index.d.ts",
183
+ "default": "./esm/useSearch/index.js"
184
+ }
185
+ },
186
+ "./useSearch/types": {
187
+ "default": {
188
+ "types": "./esm/useSearch/types.d.ts",
189
+ "default": "./esm/useSearch/types.js"
190
+ }
191
+ },
159
192
  "./useUrlHashState": {
160
193
  "default": {
161
194
  "types": "./esm/useUrlHashState/index.d.ts",
@@ -168,12 +201,54 @@
168
201
  "default": "./esm/withDocsInfra/index.js"
169
202
  }
170
203
  },
204
+ "./pipeline/getFileConventions": {
205
+ "default": {
206
+ "types": "./esm/pipeline/getFileConventions/index.d.ts",
207
+ "default": "./esm/pipeline/getFileConventions/index.js"
208
+ }
209
+ },
210
+ "./pipeline/transformMarkdownBlockquoteCallouts": {
211
+ "default": {
212
+ "types": "./esm/pipeline/transformMarkdownBlockquoteCallouts/index.d.ts",
213
+ "default": "./esm/pipeline/transformMarkdownBlockquoteCallouts/index.js"
214
+ }
215
+ },
216
+ "./pipeline/transformMarkdownDemoLinks": {
217
+ "default": {
218
+ "types": "./esm/pipeline/transformMarkdownDemoLinks/index.d.ts",
219
+ "default": "./esm/pipeline/transformMarkdownDemoLinks/index.js"
220
+ }
221
+ },
222
+ "./pipeline/transformMarkdownMetadata": {
223
+ "default": {
224
+ "types": "./esm/pipeline/transformMarkdownMetadata/index.d.ts",
225
+ "default": "./esm/pipeline/transformMarkdownMetadata/index.js"
226
+ }
227
+ },
228
+ "./pipeline/transformMarkdownMetadata/types": {
229
+ "default": {
230
+ "types": "./esm/pipeline/transformMarkdownMetadata/types.d.ts",
231
+ "default": "./esm/pipeline/transformMarkdownMetadata/types.js"
232
+ }
233
+ },
234
+ "./pipeline/transformMarkdownRelativePaths": {
235
+ "default": {
236
+ "types": "./esm/pipeline/transformMarkdownRelativePaths/index.d.ts",
237
+ "default": "./esm/pipeline/transformMarkdownRelativePaths/index.js"
238
+ }
239
+ },
171
240
  "./pipeline/hastUtils": {
172
241
  "default": {
173
242
  "types": "./esm/pipeline/hastUtils/index.d.ts",
174
243
  "default": "./esm/pipeline/hastUtils/index.js"
175
244
  }
176
245
  },
246
+ "./pipeline/loadCodeVariant": {
247
+ "default": {
248
+ "types": "./esm/pipeline/loadCodeVariant/index.d.ts",
249
+ "default": "./esm/pipeline/loadCodeVariant/index.js"
250
+ }
251
+ },
177
252
  "./pipeline/loaderUtils": {
178
253
  "default": {
179
254
  "types": "./esm/pipeline/loaderUtils/index.d.ts",
@@ -192,12 +267,30 @@
192
267
  "default": "./esm/pipeline/loadPrecomputedCodeHighlighterClient/index.js"
193
268
  }
194
269
  },
270
+ "./pipeline/loadPrecomputedSitemap": {
271
+ "default": {
272
+ "types": "./esm/pipeline/loadPrecomputedSitemap/index.d.ts",
273
+ "default": "./esm/pipeline/loadPrecomputedSitemap/index.js"
274
+ }
275
+ },
195
276
  "./pipeline/loadServerCodeMeta": {
196
277
  "default": {
197
278
  "types": "./esm/pipeline/loadServerCodeMeta/index.d.ts",
198
279
  "default": "./esm/pipeline/loadServerCodeMeta/index.js"
199
280
  }
200
281
  },
282
+ "./pipeline/loadServerPageIndex": {
283
+ "default": {
284
+ "types": "./esm/pipeline/loadServerPageIndex/index.d.ts",
285
+ "default": "./esm/pipeline/loadServerPageIndex/index.js"
286
+ }
287
+ },
288
+ "./pipeline/loadServerSitemap": {
289
+ "default": {
290
+ "types": "./esm/pipeline/loadServerSitemap/index.d.ts",
291
+ "default": "./esm/pipeline/loadServerSitemap/index.js"
292
+ }
293
+ },
201
294
  "./pipeline/loadServerSource": {
202
295
  "default": {
203
296
  "types": "./esm/pipeline/loadServerSource/index.d.ts",
@@ -210,6 +303,12 @@
210
303
  "default": "./esm/pipeline/parseSource/index.js"
211
304
  }
212
305
  },
306
+ "./pipeline/syncPageIndex": {
307
+ "default": {
308
+ "types": "./esm/pipeline/syncPageIndex/index.d.ts",
309
+ "default": "./esm/pipeline/syncPageIndex/index.js"
310
+ }
311
+ },
213
312
  "./pipeline/transformHtmlCodePrecomputed": {
214
313
  "default": {
215
314
  "types": "./esm/pipeline/transformHtmlCodePrecomputed/index.d.ts",
@@ -229,5 +328,6 @@
229
328
  }
230
329
  },
231
330
  "./esm": null
232
- }
331
+ },
332
+ "gitSha": "04aa71c45b922602c25a926df3a7e17cb3744ac1"
233
333
  }
@@ -1,3 +0,0 @@
1
- import type { Nodes } from 'hast';
2
- import { ParseSource, Transforms } from "./types.js";
3
- export declare function transformParsedSource(source: string, parsedSource: Nodes, filename: string, transforms: Transforms, parseSource: ParseSource): Promise<Record<string, any>>;