@mintlify/common 1.0.1193 → 1.0.1194

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.
@@ -0,0 +1,2 @@
1
+ import { Parser } from 'acorn';
2
+ export declare const JSXParser: typeof Parser;
@@ -0,0 +1,3 @@
1
+ import { Parser } from 'acorn';
2
+ import jsx from 'acorn-jsx';
3
+ export const JSXParser = Parser.extend(jsx());
@@ -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 { Parser } from 'acorn';
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 `{( … )}` —