@mui/internal-docs-infra 0.3.1-canary.3 → 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.
- package/esm/CodeControllerContext/CodeControllerContext.js +2 -2
- package/esm/CodeExternalsContext/CodeExternalsContext.js +1 -1
- package/esm/CodeHighlighter/CodeHighlighter.js +247 -329
- package/esm/CodeHighlighter/CodeHighlighterClient.js +447 -653
- package/esm/CodeHighlighter/CodeHighlighterContext.js +2 -2
- package/esm/CodeHighlighter/CodeHighlighterFallbackContext.js +2 -2
- package/esm/CodeHighlighter/codeToFallbackProps.js +21 -37
- package/esm/CodeHighlighter/errors.js +248 -400
- package/esm/CodeHighlighter/parseControlledCode.js +12 -20
- package/esm/CodeProvider/CodeContext.js +3 -3
- package/esm/CodeProvider/CodeProvider.js +31 -40
- package/esm/abstractCreateDemo/abstractCreateDemo.js +13 -17
- package/esm/abstractCreateDemoClient/abstractCreateDemoClient.js +12 -12
- package/esm/cli/index.js +1 -1
- package/esm/cli/runValidate.js +160 -264
- package/esm/createDemoData/createDemoData.js +11 -12
- package/esm/createSitemap/createSitemap.js +2 -2
- package/esm/pipeline/getFileConventions/fileConventions.js +1 -1
- package/esm/pipeline/getFileConventions/getFileConventions.js +2 -15
- package/esm/pipeline/hastUtils/hastUtils.js +16 -17
- package/esm/pipeline/loadCodeVariant/addCodeVariantPaths.js +24 -24
- package/esm/pipeline/loadCodeVariant/applyCodeTransform.js +12 -22
- package/esm/pipeline/loadCodeVariant/calculateMainFilePath.js +30 -37
- package/esm/pipeline/loadCodeVariant/computeHastDeltas.js +107 -185
- package/esm/pipeline/loadCodeVariant/diffHast.js +18 -53
- package/esm/pipeline/loadCodeVariant/examineCodeVariant.js +24 -27
- package/esm/pipeline/loadCodeVariant/flattenCodeVariant.js +9 -10
- package/esm/pipeline/loadCodeVariant/hasAllCodeVariants.js +5 -5
- package/esm/pipeline/loadCodeVariant/loadCodeFallback.js +516 -731
- package/esm/pipeline/loadCodeVariant/loadCodeVariant.js +679 -1079
- package/esm/pipeline/loadCodeVariant/maybeCodeInitialData.js +14 -20
- package/esm/pipeline/loadCodeVariant/mergeCodeMetadata.js +53 -63
- package/esm/pipeline/loadCodeVariant/parseCode.js +40 -48
- package/esm/pipeline/loadCodeVariant/pathUtils.js +43 -64
- package/esm/pipeline/loadCodeVariant/transformSource.js +55 -125
- package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +160 -221
- package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +377 -479
- package/esm/pipeline/loadPrecomputedCodeHighlighter/parseFunctionArguments.js +171 -173
- package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.js +14 -30
- package/esm/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +19 -21
- package/esm/pipeline/loadPrecomputedCodeHighlighter/serializeFunctionArguments.js +37 -71
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/filterRuntimeExternals.js +3 -9
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateImportStatements.js +54 -80
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateResolvedExternals.js +71 -98
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/injectImportsIntoSource.js +5 -5
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +161 -211
- package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.js +159 -207
- package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +42 -64
- package/esm/pipeline/loadServerCodeMeta/resolveModulePathWithFs.js +20 -96
- package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.js +66 -85
- package/esm/pipeline/loadServerSitemap/loadServerSitemap.js +71 -118
- package/esm/pipeline/loadServerSource/loadServerSource.js +121 -148
- package/esm/pipeline/loaderUtils/externalsToPackages.js +7 -7
- package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +8 -12
- package/esm/pipeline/loaderUtils/fileUrlToPortablePath.js +5 -5
- package/esm/pipeline/loaderUtils/getFileNameFromUrl.js +19 -29
- package/esm/pipeline/loaderUtils/getLanguageFromExtension.js +3 -4
- package/esm/pipeline/loaderUtils/mergeExternals.js +15 -35
- package/esm/pipeline/loaderUtils/parseImportsAndComments.js +413 -433
- package/esm/pipeline/loaderUtils/processRelativeImports.js +153 -239
- package/esm/pipeline/loaderUtils/resolveModulePath.js +544 -1303
- package/esm/pipeline/loaderUtils/rewriteImports.js +73 -111
- package/esm/pipeline/parseSource/addLineGutters.js +33 -45
- package/esm/pipeline/parseSource/grammars.js +3 -3
- package/esm/pipeline/parseSource/parseSource.js +13 -31
- package/esm/pipeline/syncPageIndex/createMarkdownNodes.js +32 -55
- package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.js +107 -160
- package/esm/pipeline/syncPageIndex/metadataToMarkdown.js +846 -1033
- package/esm/pipeline/syncPageIndex/syncPageIndex.js +291 -438
- package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.js +213 -311
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.js +10 -10
- package/esm/pipeline/transformMarkdownCode/transformMarkdownCode.js +133 -193
- package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.js +25 -27
- package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.js +572 -717
- package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.js +8 -8
- package/esm/pipeline/transformTypescriptToJavascript/removeTypes.js +84 -113
- package/esm/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js +10 -26
- package/esm/useCode/Pre.js +58 -62
- package/esm/useCode/useCode.js +59 -61
- package/esm/useCode/useCodeUtils.js +54 -63
- package/esm/useCode/useCopyFunctionality.js +10 -9
- package/esm/useCode/useFileNavigation.js +150 -212
- package/esm/useCode/useSourceEditing.js +17 -14
- package/esm/useCode/useTransformManagement.js +23 -26
- package/esm/useCode/useUIState.js +12 -20
- package/esm/useCode/useVariantSelection.js +62 -79
- package/esm/useCopier/index.js +29 -56
- package/esm/useDemo/createCodeSandbox.js +12 -15
- package/esm/useDemo/createStackBlitz.js +14 -20
- package/esm/useDemo/exportVariant.js +200 -180
- package/esm/useDemo/exportVariantAsCra.js +22 -25
- package/esm/useDemo/useDemo.js +80 -84
- package/esm/useErrors/ErrorsContext.js +1 -1
- package/esm/useErrors/useErrors.js +3 -3
- package/esm/useLocalStorageState/useLocalStorageState.js +23 -39
- package/esm/usePreference/PreferencesProvider.js +1 -1
- package/esm/usePreference/usePreference.js +9 -11
- package/esm/useSearch/useSearch.js +290 -387
- package/esm/useUrlHashState/useUrlHashState.js +11 -14
- package/esm/withDocsInfra/withDeploymentConfig.js +26 -21
- package/esm/withDocsInfra/withDocsInfra.js +99 -101
- 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
|
-
|
|
9
|
-
for (
|
|
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 &&
|
|
18
|
-
|
|
12
|
+
if (variantCode && typeof variantCode === 'object') {
|
|
13
|
+
let mainSource;
|
|
19
14
|
|
|
20
15
|
// Convert null to empty string, then parse
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
+
let extraFiles;
|
|
47
42
|
if (variantCode.extraFiles) {
|
|
48
|
-
|
|
49
|
-
for (
|
|
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
|
-
|
|
46
|
+
const fileSourceToProcess = fileData.source === null ? '' : fileData.source;
|
|
55
47
|
if (typeof fileSourceToProcess === 'string') {
|
|
56
48
|
// Parse string sources
|
|
57
49
|
try {
|
|
58
|
-
|
|
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
|
|
73
|
+
extraFiles,
|
|
82
74
|
filesOrder: variantCode.filesOrder
|
|
83
75
|
};
|
|
84
76
|
}
|
|
@@ -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
|
|
7
|
+
export const CodeContext = /*#__PURE__*/React.createContext({});
|
|
8
8
|
if (process.env.NODE_ENV !== "production") CodeContext.displayName = "CodeContext";
|
|
9
|
-
export
|
|
10
|
-
|
|
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(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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(
|
|
25
|
+
return Promise.resolve(() => {
|
|
29
26
|
throw new Error('parseSource not available during SSR');
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
|
-
return createStarryNight(grammars).then(
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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(
|
|
51
|
+
React.useEffect(() => {
|
|
55
52
|
// Update the sync version when available
|
|
56
|
-
sourceParser.then(
|
|
57
|
-
return setParseSource(function () {
|
|
58
|
-
return parseSourceFn;
|
|
59
|
-
});
|
|
60
|
-
});
|
|
53
|
+
sourceParser.then(parseSourceFn => setParseSource(() => parseSourceFn));
|
|
61
54
|
}, [sourceParser]);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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(
|
|
10
|
+
options.demoGlobalData.forEach(data => {
|
|
12
11
|
globalCode.push(data.precompute || data.url);
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
14
|
function DemoComponent(props) {
|
|
16
|
-
|
|
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
|
-
|
|
19
|
+
const highlighter = /*#__PURE__*/_jsx(CodeHighlighter, {
|
|
24
20
|
url: demoData.url,
|
|
25
21
|
name: demoData.name,
|
|
26
22
|
slug: demoData.slug,
|
|
27
|
-
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:
|
|
39
|
-
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
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(
|
|
21
|
-
|
|
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 =
|
|
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
|
|
36
|
-
options
|
|
37
|
-
meta
|
|
38
|
-
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
|
-
|
|
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
|
-
|
|
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));
|