@mui/internal-docs-infra 0.3.1-canary.2 → 0.3.1-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/esm/CodeControllerContext/CodeControllerContext.js +2 -2
  2. package/esm/CodeExternalsContext/CodeExternalsContext.js +1 -1
  3. package/esm/CodeHighlighter/CodeHighlighter.js +252 -327
  4. package/esm/CodeHighlighter/CodeHighlighterClient.js +447 -653
  5. package/esm/CodeHighlighter/CodeHighlighterContext.js +2 -2
  6. package/esm/CodeHighlighter/CodeHighlighterFallbackContext.js +2 -2
  7. package/esm/CodeHighlighter/codeToFallbackProps.js +21 -37
  8. package/esm/CodeHighlighter/errors.js +248 -400
  9. package/esm/CodeHighlighter/parseControlledCode.js +12 -20
  10. package/esm/CodeHighlighter/types.d.ts +7 -1
  11. package/esm/CodeProvider/CodeContext.js +3 -3
  12. package/esm/CodeProvider/CodeProvider.js +31 -40
  13. package/esm/abstractCreateDemo/abstractCreateDemo.js +13 -17
  14. package/esm/abstractCreateDemoClient/abstractCreateDemoClient.js +12 -12
  15. package/esm/cli/index.js +1 -1
  16. package/esm/cli/runValidate.js +160 -264
  17. package/esm/createDemoData/createDemoData.js +11 -12
  18. package/esm/createSitemap/createSitemap.js +2 -2
  19. package/esm/pipeline/getFileConventions/fileConventions.js +1 -1
  20. package/esm/pipeline/getFileConventions/getFileConventions.js +2 -15
  21. package/esm/pipeline/hastUtils/hastUtils.js +16 -17
  22. package/esm/pipeline/loadCodeVariant/addCodeVariantPaths.js +24 -24
  23. package/esm/pipeline/loadCodeVariant/applyCodeTransform.js +12 -22
  24. package/esm/pipeline/loadCodeVariant/calculateMainFilePath.js +30 -37
  25. package/esm/pipeline/loadCodeVariant/computeHastDeltas.js +107 -185
  26. package/esm/pipeline/loadCodeVariant/diffHast.js +18 -53
  27. package/esm/pipeline/loadCodeVariant/examineCodeVariant.js +24 -27
  28. package/esm/pipeline/loadCodeVariant/flattenCodeVariant.js +9 -10
  29. package/esm/pipeline/loadCodeVariant/hasAllCodeVariants.js +5 -5
  30. package/esm/pipeline/loadCodeVariant/loadCodeFallback.js +517 -727
  31. package/esm/pipeline/loadCodeVariant/loadCodeVariant.js +683 -1032
  32. package/esm/pipeline/loadCodeVariant/maybeCodeInitialData.js +14 -20
  33. package/esm/pipeline/loadCodeVariant/mergeCodeMetadata.js +53 -63
  34. package/esm/pipeline/loadCodeVariant/parseCode.js +40 -48
  35. package/esm/pipeline/loadCodeVariant/pathUtils.js +43 -64
  36. package/esm/pipeline/loadCodeVariant/transformSource.js +55 -125
  37. package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +160 -221
  38. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +377 -479
  39. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseFunctionArguments.js +171 -173
  40. package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.js +14 -30
  41. package/esm/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +19 -21
  42. package/esm/pipeline/loadPrecomputedCodeHighlighter/serializeFunctionArguments.js +37 -71
  43. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/filterRuntimeExternals.js +3 -9
  44. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateImportStatements.js +54 -80
  45. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateResolvedExternals.js +71 -98
  46. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/injectImportsIntoSource.js +5 -5
  47. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +161 -211
  48. package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.js +159 -207
  49. package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +42 -64
  50. package/esm/pipeline/loadServerCodeMeta/resolveModulePathWithFs.js +20 -96
  51. package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.js +66 -85
  52. package/esm/pipeline/loadServerSitemap/loadServerSitemap.js +71 -118
  53. package/esm/pipeline/loadServerSource/loadServerSource.js +121 -148
  54. package/esm/pipeline/loaderUtils/externalsToPackages.js +7 -7
  55. package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +8 -12
  56. package/esm/pipeline/loaderUtils/fileUrlToPortablePath.js +5 -5
  57. package/esm/pipeline/loaderUtils/getFileNameFromUrl.js +19 -29
  58. package/esm/pipeline/loaderUtils/getLanguageFromExtension.d.ts +24 -0
  59. package/esm/pipeline/loaderUtils/getLanguageFromExtension.js +62 -0
  60. package/esm/pipeline/loaderUtils/index.d.ts +2 -1
  61. package/esm/pipeline/loaderUtils/index.js +2 -1
  62. package/esm/pipeline/loaderUtils/mergeExternals.js +15 -35
  63. package/esm/pipeline/loaderUtils/parseImportsAndComments.js +413 -433
  64. package/esm/pipeline/loaderUtils/processRelativeImports.js +153 -239
  65. package/esm/pipeline/loaderUtils/resolveModulePath.js +544 -1303
  66. package/esm/pipeline/loaderUtils/rewriteImports.js +73 -111
  67. package/esm/pipeline/parseSource/addLineGutters.js +33 -45
  68. package/esm/pipeline/parseSource/grammars.d.ts +12 -1
  69. package/esm/pipeline/parseSource/grammars.js +36 -4
  70. package/esm/pipeline/parseSource/index.d.ts +2 -1
  71. package/esm/pipeline/parseSource/index.js +2 -1
  72. package/esm/pipeline/parseSource/parseSource.js +23 -32
  73. package/esm/pipeline/syncPageIndex/createMarkdownNodes.js +32 -55
  74. package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.js +107 -160
  75. package/esm/pipeline/syncPageIndex/metadataToMarkdown.js +846 -1033
  76. package/esm/pipeline/syncPageIndex/syncPageIndex.js +291 -438
  77. package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.js +266 -320
  78. package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.js +10 -10
  79. package/esm/pipeline/transformMarkdownCode/transformMarkdownCode.js +183 -267
  80. package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.js +25 -27
  81. package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.js +572 -717
  82. package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.js +8 -8
  83. package/esm/pipeline/transformTypescriptToJavascript/removeTypes.js +84 -113
  84. package/esm/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js +10 -26
  85. package/esm/useCode/Pre.d.ts +2 -0
  86. package/esm/useCode/Pre.js +58 -60
  87. package/esm/useCode/useCode.js +59 -61
  88. package/esm/useCode/useCodeUtils.js +54 -63
  89. package/esm/useCode/useCopyFunctionality.js +10 -9
  90. package/esm/useCode/useFileNavigation.js +171 -209
  91. package/esm/useCode/useSourceEditing.js +17 -14
  92. package/esm/useCode/useTransformManagement.js +23 -26
  93. package/esm/useCode/useUIState.js +12 -20
  94. package/esm/useCode/useVariantSelection.js +62 -79
  95. package/esm/useCopier/index.js +29 -56
  96. package/esm/useDemo/createCodeSandbox.js +12 -15
  97. package/esm/useDemo/createStackBlitz.js +14 -20
  98. package/esm/useDemo/exportVariant.js +200 -180
  99. package/esm/useDemo/exportVariantAsCra.js +22 -25
  100. package/esm/useDemo/useDemo.js +80 -84
  101. package/esm/useErrors/ErrorsContext.js +1 -1
  102. package/esm/useErrors/useErrors.js +3 -3
  103. package/esm/useLocalStorageState/useLocalStorageState.js +23 -39
  104. package/esm/usePreference/PreferencesProvider.js +1 -1
  105. package/esm/usePreference/usePreference.js +9 -11
  106. package/esm/useSearch/useSearch.js +290 -387
  107. package/esm/useUrlHashState/useUrlHashState.js +11 -14
  108. package/esm/withDocsInfra/withDeploymentConfig.js +26 -21
  109. package/esm/withDocsInfra/withDocsInfra.js +99 -101
  110. package/package.json +7 -4
@@ -1,24 +1,19 @@
1
- import _typeof from "@babel/runtime/helpers/esm/typeof";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
1
  /**
4
2
  * Pure function to parse controlled code and convert it to regular Code format.
5
3
  * Handles the conversion from ControlledCode (string|null sources) to Code (HAST nodes).
6
4
  */
7
5
  export function parseControlledCode(controlledCode, parseSource) {
8
- var parsed = {};
9
- for (var _i = 0, _Object$entries = Object.entries(controlledCode); _i < _Object$entries.length; _i++) {
10
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
11
- variant = _Object$entries$_i[0],
12
- variantCode = _Object$entries$_i[1];
6
+ const parsed = {};
7
+ for (const [variant, variantCode] of Object.entries(controlledCode)) {
13
8
  if (variantCode === null) {
14
9
  // Explicitly deleted - skip this variant
15
10
  continue;
16
11
  }
17
- if (variantCode && _typeof(variantCode) === 'object') {
18
- var mainSource = void 0;
12
+ if (variantCode && typeof variantCode === 'object') {
13
+ let mainSource;
19
14
 
20
15
  // Convert null to empty string, then parse
21
- var sourceToProcess = variantCode.source === null ? '' : variantCode.source;
16
+ const sourceToProcess = variantCode.source === null ? '' : variantCode.source;
22
17
  if (typeof sourceToProcess === 'string' && variantCode.fileName) {
23
18
  try {
24
19
  mainSource = parseSource(sourceToProcess, variantCode.fileName);
@@ -29,7 +24,7 @@ export function parseControlledCode(controlledCode, parseSource) {
29
24
  } else if (typeof sourceToProcess === 'string' && !variantCode.fileName) {
30
25
  // Return a basic HAST root node with the source text for unsupported file types
31
26
  // This indicates that the source has at least passed through the parsing pipeline
32
- var source = {
27
+ const source = {
33
28
  type: 'root',
34
29
  children: [{
35
30
  type: 'text',
@@ -43,19 +38,16 @@ export function parseControlledCode(controlledCode, parseSource) {
43
38
  }
44
39
 
45
40
  // Parse extraFiles if present
46
- var extraFiles = void 0;
41
+ let extraFiles;
47
42
  if (variantCode.extraFiles) {
48
- var parsedExtraFiles = {};
49
- for (var _i2 = 0, _Object$entries2 = Object.entries(variantCode.extraFiles); _i2 < _Object$entries2.length; _i2++) {
50
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
51
- fileName = _Object$entries2$_i[0],
52
- fileData = _Object$entries2$_i[1];
43
+ const parsedExtraFiles = {};
44
+ for (const [fileName, fileData] of Object.entries(variantCode.extraFiles)) {
53
45
  // Convert null to empty string, then parse
54
- var fileSourceToProcess = fileData.source === null ? '' : fileData.source;
46
+ const fileSourceToProcess = fileData.source === null ? '' : fileData.source;
55
47
  if (typeof fileSourceToProcess === 'string') {
56
48
  // Parse string sources
57
49
  try {
58
- var parsedSource = parseSource(fileSourceToProcess, fileName);
50
+ const parsedSource = parseSource(fileSourceToProcess, fileName);
59
51
  parsedExtraFiles[fileName] = {
60
52
  source: parsedSource
61
53
  };
@@ -78,7 +70,7 @@ export function parseControlledCode(controlledCode, parseSource) {
78
70
  fileName: variantCode.fileName,
79
71
  url: variantCode.url,
80
72
  source: mainSource,
81
- extraFiles: extraFiles,
73
+ extraFiles,
82
74
  filesOrder: variantCode.filesOrder
83
75
  };
84
76
  }
@@ -6,6 +6,8 @@ export type Components = {
6
6
  type CodeMeta = {
7
7
  /** Name of the file (e.g., 'Button.tsx') */
8
8
  fileName?: string;
9
+ /** Language for syntax highlighting (e.g., 'tsx', 'css'). When provided, fileName is not required. */
10
+ language?: string;
9
11
  /** Flattened path for the file */
10
12
  path?: string;
11
13
  };
@@ -37,6 +39,8 @@ export type VariantExtraFiles = {
37
39
  [fileName: string]: string | {
38
40
  /** Source content for this file */
39
41
  source?: VariantSource;
42
+ /** Language for syntax highlighting (e.g., 'tsx', 'css'). Derived from fileName extension if not provided. */
43
+ language?: string;
40
44
  /** Transformations that can be applied to this file */
41
45
  transforms?: Transforms;
42
46
  /** Skip generating source transformers for this file */
@@ -123,7 +127,7 @@ export type TransformSource = (source: string, fileName: string) => Promise<Reco
123
127
  source: string;
124
128
  fileName?: string;
125
129
  }> | undefined>;
126
- export type ParseSource = (source: string, fileName: string) => HastRoot;
130
+ export type ParseSource = (source: string, fileName: string, language?: string) => HastRoot;
127
131
  export type SourceTransformer = {
128
132
  extensions: string[];
129
133
  transformer: TransformSource;
@@ -190,6 +194,8 @@ export interface CodeContentProps {
190
194
  variant?: string;
191
195
  /** Currently selected file name */
192
196
  fileName?: string;
197
+ /** Language for syntax highlighting (e.g., 'tsx', 'css'). When provided, fileName is not required for parsing. */
198
+ language?: string;
193
199
  /** Default variant to show on first load */
194
200
  initialVariant?: string;
195
201
  /** Fallback variant when the requested variant is not available */
@@ -4,9 +4,9 @@ import * as React from 'react';
4
4
 
5
5
  // Type definitions for the heavy functions we're moving to context
6
6
 
7
- export var CodeContext = /*#__PURE__*/React.createContext({});
7
+ export const CodeContext = /*#__PURE__*/React.createContext({});
8
8
  if (process.env.NODE_ENV !== "production") CodeContext.displayName = "CodeContext";
9
- export var useCodeContext = function useCodeContext() {
10
- var context = React.useContext(CodeContext);
9
+ export const useCodeContext = () => {
10
+ const context = React.useContext(CodeContext);
11
11
  return context;
12
12
  };
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
3
  import * as React from 'react';
5
4
  import { createStarryNight } from '@wooorm/starry-night';
6
5
  import { CodeContext } from "./CodeContext.js";
@@ -13,25 +12,23 @@ import { parseCode } from "../pipeline/loadCodeVariant/parseCode.js";
13
12
  import { parseControlledCode } from "../CodeHighlighter/parseControlledCode.js";
14
13
  import { computeHastDeltas, getAvailableTransforms } from "../pipeline/loadCodeVariant/computeHastDeltas.js";
15
14
  import { jsx as _jsx } from "react/jsx-runtime";
16
- export function CodeProvider(_ref) {
17
- var children = _ref.children,
18
- loadCodeMeta = _ref.loadCodeMeta,
19
- loadVariantMeta = _ref.loadVariantMeta,
20
- loadSource = _ref.loadSource;
21
- var _React$useState = React.useState(undefined),
22
- _React$useState2 = _slicedToArray(_React$useState, 2),
23
- parseSource = _React$useState2[0],
24
- setParseSource = _React$useState2[1];
25
- var sourceParser = React.useMemo(function () {
15
+ export function CodeProvider({
16
+ children,
17
+ loadCodeMeta,
18
+ loadVariantMeta,
19
+ loadSource
20
+ }) {
21
+ const [parseSource, setParseSource] = React.useState(undefined);
22
+ const sourceParser = React.useMemo(() => {
26
23
  // Only initialize Starry Night in the browser, not during SSR
27
24
  if (typeof window === 'undefined') {
28
- return Promise.resolve(function () {
25
+ return Promise.resolve(() => {
29
26
  throw new Error('parseSource not available during SSR');
30
27
  });
31
28
  }
32
- return createStarryNight(grammars).then(function (starryNight) {
33
- var parseSourceFn = function parseSourceFn(source, fileName) {
34
- var fileType = fileName.slice(fileName.lastIndexOf('.'));
29
+ return createStarryNight(grammars).then(starryNight => {
30
+ const parseSourceFn = (source, fileName) => {
31
+ const fileType = fileName.slice(fileName.lastIndexOf('.'));
35
32
  if (!extensionMap[fileType]) {
36
33
  // Return a basic HAST root node with the source text for unsupported file types
37
34
  return {
@@ -42,8 +39,8 @@ export function CodeProvider(_ref) {
42
39
  }]
43
40
  };
44
41
  }
45
- var highlighted = starryNight.highlight(source, extensionMap[fileType]);
46
- var sourceLines = source.split(/\r?\n|\r/);
42
+ const highlighted = starryNight.highlight(source, extensionMap[fileType]);
43
+ const sourceLines = source.split(/\r?\n|\r/);
47
44
  starryNightGutter(highlighted, sourceLines); // mutates the tree to add line gutters
48
45
 
49
46
  return highlighted;
@@ -51,31 +48,25 @@ export function CodeProvider(_ref) {
51
48
  return parseSourceFn;
52
49
  });
53
50
  }, []);
54
- React.useEffect(function () {
51
+ React.useEffect(() => {
55
52
  // Update the sync version when available
56
- sourceParser.then(function (parseSourceFn) {
57
- return setParseSource(function () {
58
- return parseSourceFn;
59
- });
60
- });
53
+ sourceParser.then(parseSourceFn => setParseSource(() => parseSourceFn));
61
54
  }, [sourceParser]);
62
- var context = React.useMemo(function () {
63
- return {
64
- sourceParser: sourceParser,
65
- parseSource: parseSource,
66
- // Sync version when available
67
- loadSource: loadSource,
68
- loadVariantMeta: loadVariantMeta,
69
- loadCodeMeta: loadCodeMeta,
70
- // Provide the heavy functions
71
- loadCodeFallback: loadCodeFallback,
72
- loadCodeVariant: loadCodeVariant,
73
- parseCode: parseCode,
74
- parseControlledCode: parseControlledCode,
75
- computeHastDeltas: computeHastDeltas,
76
- getAvailableTransforms: getAvailableTransforms
77
- };
78
- }, [sourceParser, parseSource, loadSource, loadVariantMeta, loadCodeMeta]);
55
+ const context = React.useMemo(() => ({
56
+ sourceParser,
57
+ parseSource,
58
+ // Sync version when available
59
+ loadSource,
60
+ loadVariantMeta,
61
+ loadCodeMeta,
62
+ // Provide the heavy functions
63
+ loadCodeFallback,
64
+ loadCodeVariant,
65
+ parseCode,
66
+ parseControlledCode,
67
+ computeHastDeltas,
68
+ getAvailableTransforms
69
+ }), [sourceParser, parseSource, loadSource, loadVariantMeta, loadCodeMeta]);
79
70
  return /*#__PURE__*/_jsx(CodeContext.Provider, {
80
71
  value: context,
81
72
  children: children
@@ -1,30 +1,26 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
1
  import * as React from 'react';
3
2
  import { CodeHighlighter } from "../CodeHighlighter/index.js";
4
3
  import { createDemoDataWithVariants } from "../createDemoData/index.js";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  export function abstractCreateDemo(options, url, variants, meta) {
7
- var demoData = createDemoDataWithVariants(url, variants, meta);
8
- var variantType = options.variantTypes && options.variantTypes[Object.keys(variants).sort().join(':')];
9
- var globalCode = [];
6
+ const demoData = createDemoDataWithVariants(url, variants, meta);
7
+ const variantType = options.variantTypes && options.variantTypes[Object.keys(variants).sort().join(':')];
8
+ const globalCode = [];
10
9
  if (options.demoGlobalData) {
11
- options.demoGlobalData.forEach(function (data) {
10
+ options.demoGlobalData.forEach(data => {
12
11
  globalCode.push(data.precompute || data.url);
13
12
  });
14
13
  }
15
14
  function DemoComponent(props) {
16
- var renderedComponents = Object.entries(demoData.components).reduce(function (acc, _ref) {
17
- var _ref2 = _slicedToArray(_ref, 2),
18
- key = _ref2[0],
19
- Component = _ref2[1];
15
+ const renderedComponents = Object.entries(demoData.components).reduce((acc, [key, Component]) => {
20
16
  acc[key] = /*#__PURE__*/React.createElement(Component);
21
17
  return acc;
22
18
  }, {});
23
- var highlighter = /*#__PURE__*/_jsx(CodeHighlighter, {
19
+ const highlighter = /*#__PURE__*/_jsx(CodeHighlighter, {
24
20
  url: demoData.url,
25
21
  name: demoData.name,
26
22
  slug: demoData.slug,
27
- variantType: (meta == null ? void 0 : meta.variantType) || variantType,
23
+ variantType: meta?.variantType || variantType,
28
24
  precompute: demoData.precompute,
29
25
  globalsCode: globalCode,
30
26
  components: renderedComponents,
@@ -35,15 +31,15 @@ export function abstractCreateDemo(options, url, variants, meta) {
35
31
  loadVariantMeta: options.loadVariantMeta,
36
32
  loadSource: options.loadSource,
37
33
  sourceParser: options.sourceParser,
38
- highlightAfter: (meta == null ? void 0 : meta.highlightAfter) || options.highlightAfter,
39
- enhanceAfter: (meta == null ? void 0 : meta.enhanceAfter) || options.enhanceAfter,
34
+ highlightAfter: meta?.highlightAfter || options.highlightAfter,
35
+ enhanceAfter: meta?.enhanceAfter || options.enhanceAfter,
40
36
  controlled: options.controlled,
41
37
  fallbackUsesExtraFiles: options.fallbackUsesExtraFiles,
42
38
  fallbackUsesAllVariants: options.fallbackUsesAllVariants
43
39
  });
44
40
 
45
41
  // Use client provider if available
46
- var ClientProvider = meta == null ? void 0 : meta.ClientProvider;
42
+ const ClientProvider = meta?.ClientProvider;
47
43
  if (ClientProvider) {
48
44
  return /*#__PURE__*/_jsx(ClientProvider, {
49
45
  children: highlighter
@@ -66,7 +62,7 @@ export function abstractCreateDemo(options, url, variants, meta) {
66
62
  DemoComponent.Title = Title;
67
63
  if (process.env.NODE_ENV !== 'production') {
68
64
  DemoComponent.displayName = demoData.displayName;
69
- DemoComponent.Title.displayName = "".concat(demoData.displayName, "Title");
65
+ DemoComponent.Title.displayName = `${demoData.displayName}Title`;
70
66
  }
71
67
  return DemoComponent;
72
68
  }
@@ -77,7 +73,7 @@ export function createDemoFactory(options) {
77
73
  * @param component The component to be rendered in the demo.
78
74
  * @param meta Additional meta for the demo.
79
75
  */
80
- var createDemo = function createDemo(url, component, meta) {
76
+ const createDemo = (url, component, meta) => {
81
77
  return abstractCreateDemo(options, url, {
82
78
  Default: component
83
79
  },
@@ -94,7 +90,7 @@ export function createDemoWithVariantsFactory(options) {
94
90
  * @param variants The variants of the component to be rendered in the demo.
95
91
  * @param meta Additional meta for the demo.
96
92
  */
97
- var createDemoWithVariants = function createDemoWithVariants(url, variants, meta) {
93
+ const createDemoWithVariants = (url, variants, meta) => {
98
94
  return abstractCreateDemo(options, url, variants, meta);
99
95
  };
100
96
  return createDemoWithVariants;
@@ -9,16 +9,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  * @returns A function that creates demo client providers
10
10
  */
11
11
  export function abstractCreateDemoClient(options, url, meta) {
12
- var _meta$precompute;
13
12
  // Extract externals from precomputed data
14
- var externals = (meta == null || (_meta$precompute = meta.precompute) == null ? void 0 : _meta$precompute.externals) || {};
15
- var context = {
16
- externals: externals
13
+ const externals = meta?.precompute?.externals || {};
14
+ const context = {
15
+ externals
17
16
  };
18
17
 
19
18
  // Create a provider component that makes externals available to children
20
- function ClientProvider(_ref) {
21
- var children = _ref.children;
19
+ function ClientProvider({
20
+ children
21
+ }) {
22
22
  // In a real implementation, this would provide the externals via context
23
23
  // For now, just render children - the externals are already injected as imports
24
24
  return /*#__PURE__*/_jsx(CodeExternalsContext.Provider, {
@@ -27,15 +27,15 @@ export function abstractCreateDemoClient(options, url, meta) {
27
27
  });
28
28
  }
29
29
  if (process.env.NODE_ENV !== 'production') {
30
- ClientProvider.displayName = "ClientProvider(".concat((meta == null ? void 0 : meta.name) || 'Demo', ")");
30
+ ClientProvider.displayName = `ClientProvider(${meta?.name || 'Demo'})`;
31
31
  }
32
32
 
33
33
  // Attach metadata to the provider for debugging/inspection
34
34
  ClientProvider.clientMeta = {
35
- url: url,
36
- options: options,
37
- meta: meta,
38
- externals: externals
35
+ url,
36
+ options,
37
+ meta,
38
+ externals
39
39
  };
40
40
  return ClientProvider;
41
41
  }
@@ -45,7 +45,7 @@ export function createDemoClientFactory(options) {
45
45
  * @param url Depends on `import.meta.url` to determine the source file location.
46
46
  * @param meta Additional meta and configuration for the demo client.
47
47
  */
48
- var createDemoClient = function createDemoClient(url, meta) {
48
+ const createDemoClient = (url, meta) => {
49
49
  return abstractCreateDemoClient(options, url, meta);
50
50
  };
51
51
  return createDemoClient;
package/esm/cli/index.js CHANGED
@@ -2,5 +2,5 @@ import { createRequire } from 'node:module';
2
2
  import yargs from 'yargs';
3
3
  import { hideBin } from 'yargs/helpers';
4
4
  import runValidate from "./runValidate.js";
5
- var pkgJson = createRequire(import.meta.url)('../../package.json');
5
+ const pkgJson = createRequire(import.meta.url)('../../package.json');
6
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));