@mintlify/common 1.0.491 → 1.0.492

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.
@@ -1,6 +1,6 @@
1
1
  import { type SerializeSuccess } from '@mintlify/mdx';
2
2
  import type { PageMetaTags } from '@mintlify/models';
3
- import type { DocsConfig } from '@mintlify/validation';
3
+ import { CodeStyling } from '@mintlify/validation/dist/mint-config/schemas/v2/index.js';
4
4
  import { MdxExtracts } from '../../index.js';
5
5
  import { createSnippetTreeMap, type Snippet } from './getMdx/snippets.js';
6
6
  export type GetMdxType = {
@@ -10,13 +10,13 @@ export type GetMdxType = {
10
10
  panelMdxSource?: SerializeSuccess;
11
11
  panelMdxSourceWithNoJs?: SerializeSuccess;
12
12
  };
13
- export declare function getMdx({ path, content, metadata, snippets, subdomain, config, tailwindSelectors, pageType, }: {
13
+ export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, tailwindSelectors, pageType, }: {
14
14
  path: string;
15
15
  content: string;
16
16
  metadata: PageMetaTags;
17
17
  snippets: Snippet[];
18
18
  subdomain: string;
19
- config: DocsConfig;
19
+ codeStyling: CodeStyling;
20
20
  tailwindSelectors?: string[] | undefined;
21
21
  pageType?: 'default' | 'pdf';
22
22
  }): Promise<GetMdxType>;
@@ -12,7 +12,7 @@ import { getTailwindSelectors } from '../../css/tailwind.js';
12
12
  import { getMDXOptions, remarkMdxRemoveJs, remarkExpandContent, remarkSplitCodeGroup, remarkSplitTabs, remarkValidateSteps, remarkValidateTabs, } from '../../index.js';
13
13
  import { createSnippetTreeMap } from './getMdx/snippets.js';
14
14
  export function getMdx(_a) {
15
- return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, config, tailwindSelectors = undefined, pageType = 'default', }) {
15
+ return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, codeStyling, tailwindSelectors = undefined, pageType = 'default', }) {
16
16
  if (!tailwindSelectors)
17
17
  tailwindSelectors = yield getTailwindSelectors({ content });
18
18
  const snippetTreeMap = yield createSnippetTreeMap(snippets);
@@ -20,7 +20,7 @@ export function getMdx(_a) {
20
20
  subdomain,
21
21
  snippetTreeMap,
22
22
  pageMetadata: metadata,
23
- config,
23
+ codeStyling,
24
24
  tailwindSelectors,
25
25
  };
26
26
  let mdxExtracts = {};
@@ -34,16 +34,16 @@ export function getMdx(_a) {
34
34
  remarkPlugins: [remarkMdxRemoveJs, ...plugins],
35
35
  });
36
36
  const scope = {
37
- config,
37
+ codeStyling,
38
38
  pageMetadata: metadata,
39
39
  };
40
- const { mdxSource, mdxSourceWithNoJs } = yield compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, config, path);
40
+ const { mdxSource, mdxSourceWithNoJs } = yield compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path);
41
41
  const originalMdxExtracts = structuredClone(mdxExtracts);
42
42
  let panelMdxSource;
43
43
  let panelMdxSourceWithNoJs;
44
44
  if (mdxExtracts.panel && mdxExtracts.panel.content) {
45
45
  const panelContent = mdxExtracts.panel.content;
46
- const compiledMdx = yield compileMdx(panelContent, scope, mdxOptions, mdxOptionsNoJs, config, path);
46
+ const compiledMdx = yield compileMdx(panelContent, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path);
47
47
  panelMdxSource = compiledMdx.mdxSource;
48
48
  panelMdxSourceWithNoJs = compiledMdx.mdxSourceWithNoJs;
49
49
  // serializing mdx content with the panel content will remove the original mdxExtracts
@@ -59,28 +59,28 @@ export function getMdx(_a) {
59
59
  };
60
60
  });
61
61
  }
62
- function compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, config, path) {
62
+ function compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path) {
63
63
  return __awaiter(this, void 0, void 0, function* () {
64
- const mdxSource = yield getCompiledMdxWithFallback(content, scope, mdxOptions, config, path);
65
- const mdxSourceWithNoJs = yield getCompiledMdxWithFallback(content, scope, mdxOptionsNoJs, config, path);
64
+ const mdxSource = yield getCompiledMdxWithFallback(content, scope, mdxOptions, codeStyling, path);
65
+ const mdxSourceWithNoJs = yield getCompiledMdxWithFallback(content, scope, mdxOptionsNoJs, codeStyling, path);
66
66
  return { mdxSource, mdxSourceWithNoJs };
67
67
  });
68
68
  }
69
- function getCompiledMdxWithFallback(source, scope, mdxOptions, config, path) {
69
+ function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path) {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
- var _a;
72
71
  try {
73
72
  const result = yield serialize({
74
73
  source,
75
74
  scope,
76
75
  mdxOptions,
77
76
  syntaxHighlightingOptions: {
78
- codeStyling: (_a = config.styling) === null || _a === void 0 ? void 0 : _a.codeblocks,
77
+ codeStyling,
79
78
  },
80
79
  });
81
80
  if ('error' in result) {
82
81
  throw result.error;
83
82
  }
83
+ result.scope = Object.assign(Object.assign({}, result.scope), { config: {} });
84
84
  return result;
85
85
  }
86
86
  catch (err) {
@@ -95,6 +95,7 @@ function getCompiledMdxWithFallback(source, scope, mdxOptions, config, path) {
95
95
  if ('error' in fallbackResult) {
96
96
  throw fallbackResult.error;
97
97
  }
98
+ fallbackResult.scope = Object.assign(Object.assign({}, fallbackResult.scope), { config: {} });
98
99
  return fallbackResult;
99
100
  }
100
101
  });