@mintlify/common 1.0.429 → 1.0.430
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.
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { MdxImportSpecifier } from '../../../types/mdx/snippets/import.js';
|
|
11
11
|
import { getAST } from '../../remark.js';
|
|
12
|
-
import { containsRegularFunction } from './containsRegularFunction.js';
|
|
13
12
|
import { findExport } from './findExport.js';
|
|
14
13
|
import { injectToTopOfFileOfTree } from './injectToTopOfFile.js';
|
|
15
14
|
import { resolveComponentWithContent } from './resolveComponentWithContent.js';
|
|
@@ -40,10 +39,6 @@ export const resolveImport = (importSpecifier, destinationPageContent, importedF
|
|
|
40
39
|
const exportContent = findExport(importSpecifier.name, importedFileContent, importSpecifier.renamedName);
|
|
41
40
|
if (exportContent == undefined)
|
|
42
41
|
throw new Error(`Could not find export ${importSpecifier.name} in snippet`);
|
|
43
|
-
if (containsRegularFunction(exportContent)) {
|
|
44
|
-
console.warn(`Skipping snippet with regular function declaration. MDX parser only supports arrow functions.`);
|
|
45
|
-
return destinationPageContent;
|
|
46
|
-
}
|
|
47
42
|
// Inject "export const Component = `...`" into the top of the destination page
|
|
48
43
|
injectToTopOfFileOfTree(destinationPageContent, getAST(exportContent).children);
|
|
49
44
|
return destinationPageContent;
|
|
@@ -13,7 +13,6 @@ import { removeFrontmatterFromAST } from '../../astUtils.js';
|
|
|
13
13
|
import { getAST } from '../../remark.js';
|
|
14
14
|
import { createUniqueVariableName, isMdxJsxFlowElement } from '../../utils.js';
|
|
15
15
|
import { findAndRemoveExports } from '../findAndRemoveExports.js';
|
|
16
|
-
import { containsRegularFunction } from './containsRegularFunction.js';
|
|
17
16
|
import { injectToTopOfFileOfTree } from './injectToTopOfFile.js';
|
|
18
17
|
/**
|
|
19
18
|
*
|
|
@@ -35,13 +34,6 @@ export const resolveComponentWithContent = (tree, componentName, snippet, export
|
|
|
35
34
|
const isDefaultExport = snippetExportMap['default'] &&
|
|
36
35
|
(snippetExportMap[componentName] === undefined ||
|
|
37
36
|
Object.keys(snippetExportMap).length === 1);
|
|
38
|
-
// Check if the default export uses a regular function - if so, skip processing
|
|
39
|
-
if (isDefaultExport &&
|
|
40
|
-
snippetExportMap['default'] &&
|
|
41
|
-
containsRegularFunction(snippetExportMap['default'])) {
|
|
42
|
-
console.warn(`Skipping snippet with regular function declaration. MDX parser only supports arrow functions.`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
37
|
let snippetNodesToInject;
|
|
46
38
|
let variableDeclarationNodes = [];
|
|
47
39
|
// for named exports, replace the variables with the props
|