@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
package/README.md CHANGED
@@ -4,6 +4,7 @@ This package hosts the tools that help create the documentation.
4
4
 
5
5
  ## Documentation
6
6
 
7
- This is stored in the `docs` directory.
7
+ This is stored in the `docs` top-level directory.
8
8
 
9
- [Read More](../../docs/app/docs-infra/page.mdx)
9
+ [Read in Markdown](../../docs/app/docs-infra/page.mdx)
10
+ [Read in Browser](https://infra.mui.com/docs-infra)
@@ -5,11 +5,11 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
6
6
  import _extends from "@babel/runtime/helpers/esm/extends";
7
7
  import * as React from 'react';
8
- import { loadVariant } from "./loadVariant.js";
9
- import { loadFallbackCode } from "./loadFallbackCode.js";
8
+ import { loadCodeVariant } from "../pipeline/loadCodeVariant/loadCodeVariant.js";
9
+ import { loadCodeFallback } from "../pipeline/loadCodeVariant/loadCodeFallback.js";
10
10
  import { CodeHighlighterClient } from "./CodeHighlighterClient.js";
11
- import { maybeInitialData } from "./maybeInitialData.js";
12
- import { hasAllVariants } from "./hasAllVariants.js";
11
+ import { maybeCodeInitialData } from "../pipeline/loadCodeVariant/maybeCodeInitialData.js";
12
+ import { hasAllVariants } from "../pipeline/loadCodeVariant/hasAllCodeVariants.js";
13
13
  import { getFileNameFromUrl } from "../pipeline/loaderUtils/getFileNameFromUrl.js";
14
14
  import { codeToFallbackProps } from "./codeToFallbackProps.js";
15
15
  import * as Errors from "./errors.js";
@@ -176,7 +176,7 @@ function _CodeSourceLoader() {
176
176
  } else if (props.deferParsing === 'none') {
177
177
  output = 'hast';
178
178
  }
179
- return loadVariant(variantUrl, variantName, variantCode, {
179
+ return loadCodeVariant(variantUrl, variantName, variantCode, {
180
180
  sourceParser: props.sourceParser,
181
181
  loadSource: props.loadSource,
182
182
  loadVariantMeta: props.loadVariantMeta,
@@ -313,7 +313,7 @@ function CodeInitialSourceLoader(_x3) {
313
313
  }
314
314
  function _CodeInitialSourceLoader() {
315
315
  _CodeInitialSourceLoader = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(props) {
316
- var url, initialVariant, highlightAfter, fallbackUsesExtraFiles, fallbackUsesAllVariants, sourceParser, loadSource, loadVariantMeta, loadCodeMeta, fileName, variants, globalsCode, ContentLoading, output, _yield$loadFallbackCo, code, initialFilename, initialSource, initialExtraFiles, processedGlobalsCode;
316
+ var url, initialVariant, highlightAfter, fallbackUsesExtraFiles, fallbackUsesAllVariants, sourceParser, loadSource, loadVariantMeta, loadCodeMeta, fileName, variants, globalsCode, ContentLoading, output, _yield$loadCodeFallba, code, initialFilename, initialSource, initialExtraFiles, processedGlobalsCode;
317
317
  return _regenerator().w(function (_context4) {
318
318
  while (1) switch (_context4.n) {
319
319
  case 0:
@@ -331,7 +331,7 @@ function _CodeInitialSourceLoader() {
331
331
  output = 'hast';
332
332
  }
333
333
  _context4.n = 2;
334
- return loadFallbackCode(url, initialVariant, props.code, {
334
+ return loadCodeFallback(url, initialVariant, props.code, {
335
335
  shouldHighlight: highlightAfter === 'init',
336
336
  fallbackUsesExtraFiles: fallbackUsesExtraFiles,
337
337
  fallbackUsesAllVariants: fallbackUsesAllVariants,
@@ -345,12 +345,12 @@ function _CodeInitialSourceLoader() {
345
345
  output: output
346
346
  });
347
347
  case 2:
348
- _yield$loadFallbackCo = _context4.v;
349
- code = _yield$loadFallbackCo.code;
350
- initialFilename = _yield$loadFallbackCo.initialFilename;
351
- initialSource = _yield$loadFallbackCo.initialSource;
352
- initialExtraFiles = _yield$loadFallbackCo.initialExtraFiles;
353
- processedGlobalsCode = _yield$loadFallbackCo.processedGlobalsCode;
348
+ _yield$loadCodeFallba = _context4.v;
349
+ code = _yield$loadCodeFallba.code;
350
+ initialFilename = _yield$loadCodeFallba.initialFilename;
351
+ initialSource = _yield$loadCodeFallba.initialSource;
352
+ initialExtraFiles = _yield$loadCodeFallba.initialExtraFiles;
353
+ processedGlobalsCode = _yield$loadCodeFallba.processedGlobalsCode;
354
354
  return _context4.a(2, renderWithInitialSource(_extends(_extends({}, props), {}, {
355
355
  ContentLoading: ContentLoading,
356
356
  code: code,
@@ -417,11 +417,11 @@ export function CodeHighlighter(props) {
417
417
 
418
418
  // TODO: use initial.filesOrder to determing which source to use
419
419
 
420
- var _maybeInitialData = maybeInitialData(variants, initialKey, code || props.precompute, undefined,
420
+ var _maybeCodeInitialData = maybeCodeInitialData(variants, initialKey, code || props.precompute, undefined,
421
421
  // TODO: use initial.filesOrder if provided?
422
422
  props.highlightAfter === 'init', props.fallbackUsesExtraFiles, props.fallbackUsesAllVariants),
423
- initialData = _maybeInitialData.initialData,
424
- reason = _maybeInitialData.reason;
423
+ initialData = _maybeCodeInitialData.initialData,
424
+ reason = _maybeCodeInitialData.reason;
425
425
  if (!initialData) {
426
426
  if (DEBUG) {
427
427
  // eslint-disable-next-line no-console
@@ -9,12 +9,12 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
9
9
  import * as React from 'react';
10
10
  import { useCodeContext } from "../CodeProvider/CodeContext.js";
11
11
  import { CodeHighlighterContext } from "./CodeHighlighterContext.js";
12
- import { maybeInitialData } from "./maybeInitialData.js";
13
- import { hasAllVariants } from "./hasAllVariants.js";
12
+ import { maybeCodeInitialData } from "../pipeline/loadCodeVariant/maybeCodeInitialData.js";
13
+ import { hasAllVariants } from "../pipeline/loadCodeVariant/hasAllCodeVariants.js";
14
14
  import { CodeHighlighterFallbackContext } from "./CodeHighlighterFallbackContext.js";
15
15
  import { useControlledCode } from "../CodeControllerContext/index.js";
16
16
  import { codeToFallbackProps } from "./codeToFallbackProps.js";
17
- import { mergeMetadata } from "./mergeMetadata.js";
17
+ import { mergeCodeMetadata } from "../pipeline/loadCodeVariant/mergeCodeMetadata.js";
18
18
  import * as Errors from "./errors.js";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  var DEBUG = false; // Set to true for debugging purposes
@@ -37,9 +37,9 @@ function useInitialData(_ref) {
37
37
  loadCodeMeta = _useCodeContext.loadCodeMeta,
38
38
  loadVariantMeta = _useCodeContext.loadVariantMeta,
39
39
  loadSource = _useCodeContext.loadSource,
40
- loadFallbackCode = _useCodeContext.loadFallbackCode;
40
+ loadCodeFallback = _useCodeContext.loadCodeFallback;
41
41
  var _React$useMemo = React.useMemo(function () {
42
- return maybeInitialData(variants, variantName, code, fileName, highlightAfter === 'init', fallbackUsesExtraFiles, fallbackUsesAllVariants);
42
+ return maybeCodeInitialData(variants, variantName, code, fileName, highlightAfter === 'init', fallbackUsesExtraFiles, fallbackUsesAllVariants);
43
43
  }, [variants, variantName, code, fileName, highlightAfter, fallbackUsesExtraFiles, fallbackUsesAllVariants]),
44
44
  initialData = _React$useMemo.initialData,
45
45
  reason = _React$useMemo.reason;
@@ -49,7 +49,7 @@ function useInitialData(_ref) {
49
49
  // URL is required for loading fallback data
50
50
  throw new Errors.ErrorCodeHighlighterClientMissingUrlForFallback();
51
51
  }
52
- if (!loadFallbackCode) {
52
+ if (!loadCodeFallback) {
53
53
  throw new Errors.ErrorCodeHighlighterClientMissingLoadFallbackCode(url);
54
54
  }
55
55
  }
@@ -57,7 +57,7 @@ function useInitialData(_ref) {
57
57
  // TODO: fallbackInitialRenderOnly option? this would mean we can't fetch fallback data on the client side
58
58
  // Load initial data if not provided
59
59
  React.useEffect(function () {
60
- if (!needsFallback || !url || !loadFallbackCode) {
60
+ if (!needsFallback || !url || !loadCodeFallback) {
61
61
  return;
62
62
  }
63
63
 
@@ -73,7 +73,7 @@ function useInitialData(_ref) {
73
73
  console.log('Loading initial data for CodeHighlighterClient: ', reason);
74
74
  }
75
75
  _context.n = 1;
76
- return loadFallbackCode(url, variantName, code, {
76
+ return loadCodeFallback(url, variantName, code, {
77
77
  shouldHighlight: highlightAfter === 'init',
78
78
  fallbackUsesExtraFiles: fallbackUsesExtraFiles,
79
79
  fallbackUsesAllVariants: fallbackUsesAllVariants,
@@ -83,7 +83,7 @@ function useInitialData(_ref) {
83
83
  loadCodeMeta: loadCodeMeta,
84
84
  initialFilename: fileName,
85
85
  variants: variants,
86
- globalsCode: globalsCode // Let loadFallbackCode handle processing
86
+ globalsCode: globalsCode // Let loadCodeFallback handle processing
87
87
  })["catch"](function (error) {
88
88
  return {
89
89
  error: error
@@ -95,7 +95,7 @@ function useInitialData(_ref) {
95
95
  console.error(new Errors.ErrorCodeHighlighterClientLoadFallbackFailure(loaded.error));
96
96
  } else {
97
97
  setCode(loaded.code);
98
- // Store processed globalsCode from loadFallbackCode result
98
+ // Store processed globalsCode from loadCodeFallback result
99
99
  if (loaded.processedGlobalsCode) {
100
100
  setProcessedGlobalsCode(loaded.processedGlobalsCode);
101
101
  }
@@ -105,7 +105,7 @@ function useInitialData(_ref) {
105
105
  }
106
106
  }, _callee);
107
107
  }))();
108
- }, [initialData, reason, needsFallback, variantName, code, setCode, highlightAfter, url, sourceParser, loadSource, loadVariantMeta, loadCodeMeta, fallbackUsesExtraFiles, fallbackUsesAllVariants, fileName, variants, globalsCode, setProcessedGlobalsCode, loadFallbackCode]);
108
+ }, [initialData, reason, needsFallback, variantName, code, setCode, highlightAfter, url, sourceParser, loadSource, loadVariantMeta, loadCodeMeta, fallbackUsesExtraFiles, fallbackUsesAllVariants, fileName, variants, globalsCode, setProcessedGlobalsCode, loadCodeFallback]);
109
109
  }
110
110
  function useAllVariants(_ref3) {
111
111
  var readyForContent = _ref3.readyForContent,
@@ -121,7 +121,7 @@ function useAllVariants(_ref3) {
121
121
  loadCodeMeta = _useCodeContext2.loadCodeMeta,
122
122
  loadVariantMeta = _useCodeContext2.loadVariantMeta,
123
123
  loadSource = _useCodeContext2.loadSource,
124
- loadVariant = _useCodeContext2.loadVariant;
124
+ loadCodeVariant = _useCodeContext2.loadCodeVariant;
125
125
  var needsData = !readyForContent && !isControlled;
126
126
 
127
127
  // validation
@@ -130,7 +130,7 @@ function useAllVariants(_ref3) {
130
130
  if (!url) {
131
131
  throw new Errors.ErrorCodeHighlighterClientMissingUrlForVariants();
132
132
  }
133
- if (!loadVariant) {
133
+ if (!loadCodeVariant) {
134
134
  throw new Errors.ErrorCodeHighlighterClientMissingLoadVariant(url);
135
135
  }
136
136
  if (!code && !loadCodeMeta) {
@@ -160,9 +160,9 @@ function useAllVariants(_ref3) {
160
160
  throw new Errors.ErrorCodeHighlighterClientMissingLoadSourceForUnloadedUrls();
161
161
  }
162
162
  }
163
- }, [code, globalsCode, loadCodeMeta, loadVariant, loadSource, needsData, url]);
163
+ }, [code, globalsCode, loadCodeMeta, loadCodeVariant, loadSource, needsData, url]);
164
164
  React.useEffect(function () {
165
- if (!needsData || !url || !loadVariant) {
165
+ if (!needsData || !url || !loadCodeVariant) {
166
166
  return;
167
167
  }
168
168
 
@@ -245,7 +245,7 @@ function useAllVariants(_ref3) {
245
245
  }).filter(function (item) {
246
246
  return Boolean(item);
247
247
  });
248
- return loadVariant(url, name, loadedCode[name], {
248
+ return loadCodeVariant(url, name, loadedCode[name], {
249
249
  disableParsing: true,
250
250
  disableTransforms: true,
251
251
  loadSource: loadSource,
@@ -297,7 +297,7 @@ function useAllVariants(_ref3) {
297
297
  }
298
298
  }, _callee3, null, [[0, 8]]);
299
299
  }))();
300
- }, [needsData, variants, url, code, setCode, loadSource, loadVariantMeta, loadCodeMeta, processedGlobalsCode, globalsCode, setProcessedGlobalsCode, loadVariant]);
300
+ }, [needsData, variants, url, code, setCode, loadSource, loadVariantMeta, loadCodeMeta, processedGlobalsCode, globalsCode, setProcessedGlobalsCode, loadCodeVariant]);
301
301
  return {
302
302
  readyForContent: readyForContent
303
303
  };
@@ -396,7 +396,7 @@ function useCodeTransforms(_ref7) {
396
396
  var _useCodeContext4 = useCodeContext(),
397
397
  sourceParser = _useCodeContext4.sourceParser,
398
398
  getAvailableTransforms = _useCodeContext4.getAvailableTransforms,
399
- applyTransforms = _useCodeContext4.applyTransforms;
399
+ computeHastDeltas = _useCodeContext4.computeHastDeltas;
400
400
  var _React$useState3 = React.useState(undefined),
401
401
  _React$useState4 = _slicedToArray(_React$useState3, 2),
402
402
  transformedCode = _React$useState4[0],
@@ -412,7 +412,7 @@ function useCodeTransforms(_ref7) {
412
412
 
413
413
  // Effect to compute transformations for all variants
414
414
  React.useEffect(function () {
415
- if (!parsedCode || !sourceParser || !applyTransforms) {
415
+ if (!parsedCode || !sourceParser || !computeHastDeltas) {
416
416
  setTransformedCode(parsedCode);
417
417
  return;
418
418
  }
@@ -429,7 +429,7 @@ function useCodeTransforms(_ref7) {
429
429
  case 1:
430
430
  parseSource = _context4.v;
431
431
  _context4.n = 2;
432
- return applyTransforms(parsedCode, parseSource);
432
+ return computeHastDeltas(parsedCode, parseSource);
433
433
  case 2:
434
434
  enhanced = _context4.v;
435
435
  setTransformedCode(enhanced);
@@ -445,7 +445,7 @@ function useCodeTransforms(_ref7) {
445
445
  }
446
446
  }, _callee4, null, [[0, 3]]);
447
447
  }))();
448
- }, [parsedCode, sourceParser, applyTransforms]);
448
+ }, [parsedCode, sourceParser, computeHastDeltas]);
449
449
  return {
450
450
  transformedCode: transformedCode,
451
451
  availableTransforms: availableTransforms
@@ -500,7 +500,7 @@ function useGlobalsCodeMerging(_ref0) {
500
500
  loadCodeMeta = _useCodeContext6.loadCodeMeta,
501
501
  loadSource = _useCodeContext6.loadSource,
502
502
  loadVariantMeta = _useCodeContext6.loadVariantMeta,
503
- loadVariant = _useCodeContext6.loadVariant;
503
+ loadCodeVariant = _useCodeContext6.loadCodeVariant;
504
504
 
505
505
  // Set processedGlobalsCode if we have ready Code objects but haven't stored them yet
506
506
  React.useEffect(function () {
@@ -523,7 +523,7 @@ function useGlobalsCodeMerging(_ref0) {
523
523
  }
524
524
  // If not all ready, fall through to loading logic below
525
525
  }
526
- if (!loadVariant) {
526
+ if (!loadCodeVariant) {
527
527
  console.error(new Errors.ErrorCodeHighlighterClientMissingLoadVariantForGlobals());
528
528
  return;
529
529
  }
@@ -606,7 +606,7 @@ function useGlobalsCodeMerging(_ref0) {
606
606
  case 1:
607
607
  _context6.p = 1;
608
608
  _context6.n = 2;
609
- return loadVariant(originalUrl || '',
609
+ return loadCodeVariant(originalUrl || '',
610
610
  // Use the original URL if available
611
611
  variantName, codeObj[variantName],
612
612
  // May be undefined or string
@@ -658,7 +658,7 @@ function useGlobalsCodeMerging(_ref0) {
658
658
  }
659
659
  }, _callee8, null, [[0, 3]]);
660
660
  }))();
661
- }, [url, globalsCode, processedGlobalsCode, setProcessedGlobalsCode, loadCodeMeta, loadSource, loadVariantMeta, variants, loadVariant]);
661
+ }, [url, globalsCode, processedGlobalsCode, setProcessedGlobalsCode, loadCodeMeta, loadSource, loadVariantMeta, variants, loadCodeVariant]);
662
662
 
663
663
  // Determine globalsCodeObjects to use (prefer processed, fallback to direct if ready)
664
664
  var globalsCodeObjects = React.useMemo(function () {
@@ -707,11 +707,11 @@ function useGlobalsCodeMerging(_ref0) {
707
707
  return Boolean(item) && _typeof(item) === 'object';
708
708
  });
709
709
  if (globalsForVariant.length > 0) {
710
- // Use mergeMetadata for sophisticated globals merging with proper positioning
710
+ // Use mergeCodeMetadata for sophisticated globals merging with proper positioning
711
711
  var currentVariant = variantData;
712
712
  globalsForVariant.forEach(function (globalVariant) {
713
713
  if (globalVariant.extraFiles) {
714
- // Convert globals extraFiles to metadata format for mergeMetadata
714
+ // Convert globals extraFiles to metadata format for mergeCodeMetadata
715
715
  var globalsMetadata = {};
716
716
  for (var _i = 0, _Object$entries = Object.entries(globalVariant.extraFiles); _i < _Object$entries.length; _i++) {
717
717
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -726,8 +726,8 @@ function useGlobalsCodeMerging(_ref0) {
726
726
  }
727
727
  }
728
728
 
729
- // Use mergeMetadata to properly position and merge the globals
730
- currentVariant = mergeMetadata(currentVariant, globalsMetadata);
729
+ // Use mergeCodeMetadata to properly position and merge the globals
730
+ currentVariant = mergeCodeMetadata(currentVariant, globalsMetadata);
731
731
  }
732
732
  });
733
733
 
@@ -774,11 +774,11 @@ function usePropsCodeGlobalsMerging(_ref14) {
774
774
  return Boolean(item) && _typeof(item) === 'object';
775
775
  });
776
776
  if (globalsForVariant.length > 0) {
777
- // Use mergeMetadata for sophisticated globals merging with proper positioning
777
+ // Use mergeCodeMetadata for sophisticated globals merging with proper positioning
778
778
  var currentVariant = variantData;
779
779
  globalsForVariant.forEach(function (globalVariant) {
780
780
  if (globalVariant.extraFiles) {
781
- // Convert globals extraFiles to metadata format for mergeMetadata
781
+ // Convert globals extraFiles to metadata format for mergeCodeMetadata
782
782
  var globalsMetadata = {};
783
783
  for (var _i2 = 0, _Object$entries2 = Object.entries(globalVariant.extraFiles); _i2 < _Object$entries2.length; _i2++) {
784
784
  var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
@@ -793,8 +793,8 @@ function usePropsCodeGlobalsMerging(_ref14) {
793
793
  }
794
794
  }
795
795
 
796
- // Use mergeMetadata to properly position and merge the globals
797
- currentVariant = mergeMetadata(currentVariant, globalsMetadata);
796
+ // Use mergeCodeMetadata to properly position and merge the globals
797
+ currentVariant = mergeCodeMetadata(currentVariant, globalsMetadata);
798
798
  }
799
799
  });
800
800
 
@@ -230,7 +230,7 @@ export var ErrorCodeHighlighterServerLoadVariantsFailure = /*#__PURE__*/function
230
230
  export var ErrorCodeHighlighterClientMissingLoadFallbackCode = /*#__PURE__*/function (_ErrorCodeHighlighter21) {
231
231
  function ErrorCodeHighlighterClientMissingLoadFallbackCode(url) {
232
232
  _classCallCheck(this, ErrorCodeHighlighterClientMissingLoadFallbackCode);
233
- return _callSuper(this, ErrorCodeHighlighterClientMissingLoadFallbackCode, ["Missing loadFallbackCode function - loadFallbackCode is required (".concat(url || 'No URL', ") add a <CodeProvider />")]);
233
+ return _callSuper(this, ErrorCodeHighlighterClientMissingLoadFallbackCode, ["Missing loadCodeFallback function - loadCodeFallback is required (".concat(url || 'No URL', ") add a <CodeProvider />")]);
234
234
  }
235
235
  _inherits(ErrorCodeHighlighterClientMissingLoadFallbackCode, _ErrorCodeHighlighter21);
236
236
  return _createClass(ErrorCodeHighlighterClientMissingLoadFallbackCode);
@@ -238,7 +238,7 @@ export var ErrorCodeHighlighterClientMissingLoadFallbackCode = /*#__PURE__*/func
238
238
  export var ErrorCodeHighlighterClientMissingLoadVariant = /*#__PURE__*/function (_ErrorCodeHighlighter22) {
239
239
  function ErrorCodeHighlighterClientMissingLoadVariant(url) {
240
240
  _classCallCheck(this, ErrorCodeHighlighterClientMissingLoadVariant);
241
- return _callSuper(this, ErrorCodeHighlighterClientMissingLoadVariant, ["Missing loadVariant function - loadVariant function is required when no initial code is provided (".concat(url || 'No URL', ")")]);
241
+ return _callSuper(this, ErrorCodeHighlighterClientMissingLoadVariant, ["Missing loadCodeVariant function - loadCodeVariant function is required when no initial code is provided (".concat(url || 'No URL', ")")]);
242
242
  }
243
243
  _inherits(ErrorCodeHighlighterClientMissingLoadVariant, _ErrorCodeHighlighter22);
244
244
  return _createClass(ErrorCodeHighlighterClientMissingLoadVariant);
@@ -417,7 +417,7 @@ export var ErrorCodeHighlighterClientTransformProcessingFailure = /*#__PURE__*/f
417
417
  export var ErrorCodeHighlighterClientMissingLoadVariantForGlobals = /*#__PURE__*/function (_ErrorCodeHighlighter42) {
418
418
  function ErrorCodeHighlighterClientMissingLoadVariantForGlobals() {
419
419
  _classCallCheck(this, ErrorCodeHighlighterClientMissingLoadVariantForGlobals);
420
- return _callSuper(this, ErrorCodeHighlighterClientMissingLoadVariantForGlobals, ["loadVariant function is required for loading missing variants in globalsCode"]);
420
+ return _callSuper(this, ErrorCodeHighlighterClientMissingLoadVariantForGlobals, ["loadCodeVariant function is required for loading missing variants in globalsCode"]);
421
421
  }
422
422
  _inherits(ErrorCodeHighlighterClientMissingLoadVariantForGlobals, _ErrorCodeHighlighter42);
423
423
  return _createClass(ErrorCodeHighlighterClientMissingLoadVariantForGlobals);
@@ -149,7 +149,7 @@ export interface LoadFileOptions {
149
149
  output?: 'hast' | 'hastJson' | 'hastGzip';
150
150
  }
151
151
  /**
152
- * Options for the loadVariant function, extending LoadFileOptions with required function dependencies
152
+ * Options for the loadCodeVariant function, extending LoadFileOptions with required function dependencies
153
153
  */
154
154
  export interface LoadVariantOptions extends LoadFileOptions, Pick<CodeFunctionProps, 'sourceParser' | 'loadSource' | 'loadVariantMeta' | 'sourceTransformers'> {}
155
155
  /**
@@ -11,7 +11,7 @@ export type LoadVariantFn = (url: string | undefined, variantName: string, varia
11
11
  }>;
12
12
  export type ParseCodeFn = (code: Code, parseSource: ParseSource) => Code;
13
13
  export type ParseControlledCodeFn = (controlledCode: ControlledCode, parseSource: ParseSource) => Code;
14
- export type ApplyTransformsFn = (parsedCode: Code, parseSource: ParseSource) => Promise<Code>;
14
+ export type ComputeHastDeltasFn = (parsedCode: Code, parseSource: ParseSource) => Promise<Code>;
15
15
  export type GetAvailableTransformsFn = (parsedCode: Code | undefined, variantName: string) => string[];
16
16
  export interface CodeContext {
17
17
  sourceParser?: Promise<ParseSource>;
@@ -20,11 +20,11 @@ export interface CodeContext {
20
20
  loadSource?: LoadSource;
21
21
  loadVariantMeta?: LoadVariantMeta;
22
22
  loadCodeMeta?: LoadCodeMeta;
23
- loadFallbackCode?: LoadFallbackCodeFn;
24
- loadVariant?: LoadVariantFn;
23
+ loadCodeFallback?: LoadFallbackCodeFn;
24
+ loadCodeVariant?: LoadVariantFn;
25
25
  parseCode?: ParseCodeFn;
26
26
  parseControlledCode?: ParseControlledCodeFn;
27
- applyTransforms?: ApplyTransformsFn;
27
+ computeHastDeltas?: ComputeHastDeltasFn;
28
28
  getAvailableTransforms?: GetAvailableTransformsFn;
29
29
  }
30
30
  export declare const CodeContext: React.Context<CodeContext>;
@@ -7,11 +7,11 @@ import { CodeContext } from "./CodeContext.js";
7
7
  import { extensionMap, grammars } from "../pipeline/parseSource/grammars.js";
8
8
  import { starryNightGutter } from "../pipeline/parseSource/addLineGutters.js";
9
9
  // Import the heavy functions
10
- import { loadFallbackCode } from "../CodeHighlighter/loadFallbackCode.js";
11
- import { loadVariant } from "../CodeHighlighter/loadVariant.js";
12
- import { parseCode } from "../CodeHighlighter/parseCode.js";
10
+ import { loadCodeFallback } from "../pipeline/loadCodeVariant/loadCodeFallback.js";
11
+ import { loadCodeVariant } from "../pipeline/loadCodeVariant/loadCodeVariant.js";
12
+ import { parseCode } from "../pipeline/loadCodeVariant/parseCode.js";
13
13
  import { parseControlledCode } from "../CodeHighlighter/parseControlledCode.js";
14
- import { applyTransforms, getAvailableTransforms } from "../CodeHighlighter/transformCode.js";
14
+ import { computeHastDeltas, getAvailableTransforms } from "../pipeline/loadCodeVariant/computeHastDeltas.js";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  export function CodeProvider(_ref) {
17
17
  var children = _ref.children,
@@ -68,11 +68,11 @@ export function CodeProvider(_ref) {
68
68
  loadVariantMeta: loadVariantMeta,
69
69
  loadCodeMeta: loadCodeMeta,
70
70
  // Provide the heavy functions
71
- loadFallbackCode: loadFallbackCode,
72
- loadVariant: loadVariant,
71
+ loadCodeFallback: loadCodeFallback,
72
+ loadCodeVariant: loadCodeVariant,
73
73
  parseCode: parseCode,
74
74
  parseControlledCode: parseControlledCode,
75
- applyTransforms: applyTransforms,
75
+ computeHastDeltas: computeHastDeltas,
76
76
  getAvailableTransforms: getAvailableTransforms
77
77
  };
78
78
  }, [sourceParser, parseSource, loadSource, loadVariantMeta, loadCodeMeta]);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'node:module';
2
+ import yargs from 'yargs';
3
+ import { hideBin } from 'yargs/helpers';
4
+ import runValidate from "./runValidate.js";
5
+ var pkgJson = createRequire(import.meta.url)('../../package.json');
6
+ yargs().scriptName('docs-infra').usage('$0 <command> [args]').command(runValidate).demandCommand(1, 'You need at least one command before moving on').strict().help().version(pkgJson.version).parse(hideBin(process.argv));
@@ -0,0 +1,8 @@
1
+ import type { CommandModule } from 'yargs';
2
+ type Args = {
3
+ paths?: string[];
4
+ command?: string;
5
+ useVisibleDescription?: boolean;
6
+ };
7
+ declare const runValidate: CommandModule<{}, Args>;
8
+ export default runValidate;