@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
|
@@ -24,43 +24,43 @@
|
|
|
24
24
|
* <DemoSomething />
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
export const transformMarkdownDemoLinks = () => {
|
|
28
|
+
return tree => {
|
|
29
|
+
const parent = tree;
|
|
30
|
+
const children = parent.children;
|
|
31
|
+
for (let i = 0; i < children.length - 1; i += 1) {
|
|
32
|
+
const current = children[i];
|
|
33
|
+
const next = children[i + 1];
|
|
34
|
+
const separator = children[i + 2]; // May not exist
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
let hasDemo = false;
|
|
37
37
|
|
|
38
38
|
// Check if current node is an HTML element containing a Demo component without .Title
|
|
39
|
-
if (
|
|
40
|
-
|
|
39
|
+
if (current?.type === 'html') {
|
|
40
|
+
const htmlNode = current;
|
|
41
41
|
hasDemo = htmlNode.value.includes('<Demo') && !htmlNode.value.includes('.Title');
|
|
42
|
-
} else if (
|
|
42
|
+
} else if (current?.type === 'mdxJsxFlowElement') {
|
|
43
43
|
// Check if current node is an MDX JSX element (for imported Demo components)
|
|
44
|
-
|
|
44
|
+
const mdxNode = current;
|
|
45
45
|
if (mdxNode.name && mdxNode.name.includes('Demo') && !mdxNode.name.includes('.Title')) {
|
|
46
46
|
hasDemo = true;
|
|
47
47
|
}
|
|
48
|
-
} else if (
|
|
48
|
+
} else if (current?.type === 'paragraph') {
|
|
49
49
|
// Check if paragraph contains only a single HTML node with a Demo component
|
|
50
|
-
|
|
50
|
+
const paragraphNode = current;
|
|
51
51
|
if (paragraphNode.children.length === 1 && paragraphNode.children[0].type === 'html') {
|
|
52
|
-
|
|
53
|
-
hasDemo =
|
|
52
|
+
const htmlNode = paragraphNode.children[0];
|
|
53
|
+
hasDemo = htmlNode.value.includes('<Demo') && !htmlNode.value.includes('.Title');
|
|
54
54
|
} else if (paragraphNode.children.length >= 2 && paragraphNode.children[0].type === 'html' && paragraphNode.children[paragraphNode.children.length - 1].type === 'html') {
|
|
55
55
|
// Check if this looks like a Demo component with opening and closing tags
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const openingTag = paragraphNode.children[0];
|
|
57
|
+
const closingTag = paragraphNode.children[paragraphNode.children.length - 1];
|
|
58
58
|
if (openingTag.value.includes('<Demo') && !openingTag.value.includes('.Title') && closingTag.value.includes('</Demo')) {
|
|
59
59
|
hasDemo = true;
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
62
62
|
// Check if paragraph contains any HTML nodes with Demo components (mixed content)
|
|
63
|
-
hasDemo = paragraphNode.children.some(
|
|
63
|
+
hasDemo = paragraphNode.children.some(child => {
|
|
64
64
|
return child.type === 'html' && child.value.includes('<Demo') && !child.value.includes('.Title');
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -68,18 +68,16 @@ export var transformMarkdownDemoLinks = function transformMarkdownDemoLinks() {
|
|
|
68
68
|
if (!hasDemo) {
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
let removedSomething = false;
|
|
72
72
|
|
|
73
73
|
// Check if next node is a paragraph containing a "See Demo" link
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
return child.type === 'link' && child.children.some(
|
|
77
|
-
return linkChild.type === 'text' && linkChild.value === 'See Demo';
|
|
78
|
-
});
|
|
74
|
+
if (next?.type === 'paragraph') {
|
|
75
|
+
const hasSeeDemo = next.children.some(child => {
|
|
76
|
+
return child.type === 'link' && child.children.some(linkChild => linkChild.type === 'text' && linkChild.value === 'See Demo');
|
|
79
77
|
});
|
|
80
78
|
|
|
81
79
|
// Check if there's also a thematic break (---) after the paragraph
|
|
82
|
-
|
|
80
|
+
const hasThematicBreak = separator?.type === 'thematicBreak';
|
|
83
81
|
if (hasSeeDemo) {
|
|
84
82
|
// Remove the "See Demo" paragraph and any following thematic break
|
|
85
83
|
if (hasThematicBreak) {
|