@mintlify/common 1.0.1193 → 1.0.1195
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/dist/mdx/lib/jsxParser.d.ts +2 -0
- package/dist/mdx/lib/jsxParser.js +3 -0
- package/dist/mdx/plugins/rehype/rehypeZoomImages.js +6 -2
- package/dist/mdx/plugins/remark/remarkMdxExpandExpressions.js +1 -3
- package/dist/mdx/plugins/remark/remarkTitleMarkdown.js +1 -3
- package/dist/mdx/snippets/getJsxEsmTree.js +1 -3
- package/dist/mdx/snippets/resolveImport/resolveComponentWithContent.js +1 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -5,7 +5,9 @@ const isInsideTile = (ancestors) => ancestors.some((ancestor) => typeof ancestor
|
|
|
5
5
|
'name' in ancestor &&
|
|
6
6
|
ancestor.name === 'Tile');
|
|
7
7
|
export const rehypeZoomImages = () => (tree) => {
|
|
8
|
-
visitParents(tree, 'mdxJsxFlowElement', (node, ancestors) => {
|
|
8
|
+
visitParents(tree, ['mdxJsxFlowElement', 'mdxJsxTextElement'], (node, ancestors) => {
|
|
9
|
+
if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement')
|
|
10
|
+
return;
|
|
9
11
|
if (node.name !== 'img' &&
|
|
10
12
|
node.name !== 'picture' &&
|
|
11
13
|
node.name !== 'figure' &&
|
|
@@ -23,12 +25,14 @@ export const rehypeZoomImages = () => (tree) => {
|
|
|
23
25
|
if (shouldSkipZoom)
|
|
24
26
|
return;
|
|
25
27
|
if (node.name === 'iframe') {
|
|
28
|
+
if (node.type !== 'mdxJsxFlowElement')
|
|
29
|
+
return;
|
|
26
30
|
parent.children.splice(index, 1, u('mdxJsxFlowElement', { name: 'OptimizedFrame', attributes: node.attributes }, []));
|
|
27
31
|
return;
|
|
28
32
|
}
|
|
29
33
|
// For img elements, replace with OptimizedImage (it applies Zoom internally)
|
|
30
34
|
if (node.name === 'img') {
|
|
31
|
-
const optimizedImg = u(
|
|
35
|
+
const optimizedImg = u(node.type, {
|
|
32
36
|
name: 'OptimizedImage',
|
|
33
37
|
attributes: node.attributes,
|
|
34
38
|
}, []);
|
|
@@ -7,8 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Parser } from 'acorn';
|
|
11
|
-
import jsx from 'acorn-jsx';
|
|
12
10
|
import { jsx as jsxHandlers, toJs } from 'estree-util-to-js';
|
|
13
11
|
import { walk } from 'estree-walker';
|
|
14
12
|
import { toEstree } from 'hast-util-to-estree';
|
|
@@ -16,6 +14,7 @@ import remarkRehype from 'remark-rehype';
|
|
|
16
14
|
import { unified } from 'unified';
|
|
17
15
|
import { visit } from 'unist-util-visit';
|
|
18
16
|
import { visitParents } from 'unist-util-visit-parents';
|
|
17
|
+
import { JSXParser } from '../../lib/jsxParser.js';
|
|
19
18
|
import { decodeMdxFragmentCode } from '../../preprocessMdxFragmentCode.js';
|
|
20
19
|
import { getAST } from '../../remark.js';
|
|
21
20
|
import { getExportedFunctionNames } from './remarkMdxClientComponentBoundaries.js';
|
|
@@ -29,7 +28,6 @@ const REMARK_REHYPE_OPTIONS = {
|
|
|
29
28
|
'mdxjsEsm',
|
|
30
29
|
],
|
|
31
30
|
};
|
|
32
|
-
const JSXParser = Parser.extend(jsx());
|
|
33
31
|
/**
|
|
34
32
|
* Bounds on the work a single page compile may spend expanding `<MDX>` fragments. Every fragment
|
|
35
33
|
* re-runs the remark/rehype pipeline on its source and text nested `d` levels deep is compiled
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Parser } from 'acorn';
|
|
2
|
-
import jsx from 'acorn-jsx';
|
|
3
1
|
import { visit } from 'unist-util-visit';
|
|
2
|
+
import { JSXParser } from '../../lib/jsxParser.js';
|
|
4
3
|
import { parseTitleMarkdown, titleMarkdownToText } from '../../titleMarkdown.js';
|
|
5
|
-
const JSXParser = Parser.extend(jsx());
|
|
6
4
|
export const TITLE_COMPONENTS = new Set([
|
|
7
5
|
'Accordion',
|
|
8
6
|
'Card',
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import jsx from 'acorn-jsx';
|
|
1
|
+
import { JSXParser } from '../lib/jsxParser.js';
|
|
3
2
|
import { isTsxFile } from './isJsxOrTsx.js';
|
|
4
3
|
import { stripTsxTypes } from './stripTsxTypes.js';
|
|
5
|
-
const JSXParser = Parser.extend(jsx());
|
|
6
4
|
/**
|
|
7
5
|
* Get the AST for a JSX/TSX snippet
|
|
8
6
|
* @param jsxContent the content of the JSX/TSX snippet
|
|
@@ -7,12 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Parser } from 'acorn';
|
|
11
|
-
import acornJsx from 'acorn-jsx';
|
|
12
10
|
import { jsx, toJs } from 'estree-util-to-js';
|
|
13
11
|
import { walk } from 'estree-walker';
|
|
14
12
|
import { visit } from 'unist-util-visit';
|
|
15
13
|
import { removeFrontmatterFromAST } from '../../astUtils.js';
|
|
14
|
+
import { JSXParser } from '../../lib/jsxParser.js';
|
|
16
15
|
import { getAST } from '../../remark.js';
|
|
17
16
|
import { createUniqueVariableName, isMdxJsxFlowElement } from '../../utils.js';
|
|
18
17
|
import { findAndRemoveExports } from '../findAndRemoveExports.js';
|
|
@@ -207,7 +206,6 @@ const replaceVariablesWithProps = (node, treeToInject, exportMap, snippetExportM
|
|
|
207
206
|
};
|
|
208
207
|
};
|
|
209
208
|
const generate = (estree) => toJs(estree, { handlers: jsx }).value.replace(/;\s*$/, '');
|
|
210
|
-
const JSXParser = Parser.extend(acornJsx());
|
|
211
209
|
/**
|
|
212
210
|
* Parse `text` as a single expression; undefined when it is not one on its own. `preserveParens`
|
|
213
211
|
* so `( … )` around the whole expression — common when a snippet wraps a ternary in `{( … )}` —
|