@mintlify/common 1.0.1011 → 1.0.1012
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.
|
@@ -11,6 +11,7 @@ export type GetMdxType = {
|
|
|
11
11
|
mdxExtracts: MdxExtracts;
|
|
12
12
|
panelMdxSource?: SerializeSuccess;
|
|
13
13
|
panelMdxSourceWithNoJs?: SerializeSuccess;
|
|
14
|
+
parseFailed?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors, pageType, trace, customLanguages, variables, rehypePlugins, remarkPlugins, allowedComponents, }: {
|
|
16
17
|
path: string;
|
|
@@ -54,7 +54,7 @@ export function getMdx(_a) {
|
|
|
54
54
|
config,
|
|
55
55
|
pageMetadata: metadata,
|
|
56
56
|
};
|
|
57
|
-
const { mdxSource, mdxSourceWithNoJs } = yield traceFn('getMdx.compileMdx.mainContent', () => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const { mdxSource, mdxSourceWithNoJs, parseFailed: mainParseFailed, } = yield traceFn('getMdx.compileMdx.mainContent', () => __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
return compileMdx({
|
|
59
59
|
content: processedContent,
|
|
60
60
|
scope,
|
|
@@ -66,6 +66,7 @@ export function getMdx(_a) {
|
|
|
66
66
|
customLanguages,
|
|
67
67
|
});
|
|
68
68
|
}));
|
|
69
|
+
let parseFailed = mainParseFailed;
|
|
69
70
|
const originalMdxExtracts = structuredClone(mdxExtracts);
|
|
70
71
|
let panelMdxSource;
|
|
71
72
|
let panelMdxSourceWithNoJs;
|
|
@@ -85,6 +86,7 @@ export function getMdx(_a) {
|
|
|
85
86
|
}));
|
|
86
87
|
panelMdxSource = compiledMdx.mdxSource;
|
|
87
88
|
panelMdxSourceWithNoJs = compiledMdx.mdxSourceWithNoJs;
|
|
89
|
+
parseFailed = parseFailed || compiledMdx.parseFailed;
|
|
88
90
|
// serializing mdx content with the panel content will remove the original mdxExtracts
|
|
89
91
|
// so we need to restore the original mdxExtracts
|
|
90
92
|
mdxExtracts = Object.assign(Object.assign({}, originalMdxExtracts), { codeExamples: mdxExtracts.codeExamples });
|
|
@@ -93,18 +95,16 @@ export function getMdx(_a) {
|
|
|
93
95
|
if (mdxExtracts.multiViewItems) {
|
|
94
96
|
mdxExtracts.multiViewItems = mdxExtracts.multiViewItems.map((item, index) => (Object.assign(Object.assign({}, item), { active: index === 0 })));
|
|
95
97
|
}
|
|
96
|
-
return {
|
|
97
|
-
mdxExtracts,
|
|
98
|
+
return Object.assign({ mdxExtracts,
|
|
98
99
|
mdxSource,
|
|
99
100
|
mdxSourceWithNoJs,
|
|
100
101
|
panelMdxSource,
|
|
101
|
-
panelMdxSourceWithNoJs,
|
|
102
|
-
};
|
|
102
|
+
panelMdxSourceWithNoJs }, (parseFailed && { parseFailed }));
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
function compileMdx(_a) {
|
|
106
106
|
return __awaiter(this, arguments, void 0, function* ({ content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn, customLanguages, }) {
|
|
107
|
-
const
|
|
107
|
+
const withJs = yield traceFn('compileMdx.withJs', () => __awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
return getCompiledMdxWithFallback({
|
|
109
109
|
source: content,
|
|
110
110
|
scope,
|
|
@@ -115,7 +115,7 @@ function compileMdx(_a) {
|
|
|
115
115
|
customLanguages,
|
|
116
116
|
});
|
|
117
117
|
}));
|
|
118
|
-
const
|
|
118
|
+
const withoutJs = yield traceFn('compileMdx.withoutJs', () => __awaiter(this, void 0, void 0, function* () {
|
|
119
119
|
return getCompiledMdxWithFallback({
|
|
120
120
|
source: content,
|
|
121
121
|
scope,
|
|
@@ -126,7 +126,11 @@ function compileMdx(_a) {
|
|
|
126
126
|
customLanguages,
|
|
127
127
|
});
|
|
128
128
|
}));
|
|
129
|
-
return {
|
|
129
|
+
return {
|
|
130
|
+
mdxSource: withJs.result,
|
|
131
|
+
mdxSourceWithNoJs: withoutJs.result,
|
|
132
|
+
parseFailed: withJs.parseFailed || withoutJs.parseFailed,
|
|
133
|
+
};
|
|
130
134
|
});
|
|
131
135
|
}
|
|
132
136
|
function getCompiledMdxWithFallback(_a) {
|
|
@@ -145,7 +149,7 @@ function getCompiledMdxWithFallback(_a) {
|
|
|
145
149
|
throw result.error;
|
|
146
150
|
}
|
|
147
151
|
result.scope = Object.assign(Object.assign({}, result.scope), { config: {} });
|
|
148
|
-
return result;
|
|
152
|
+
return { result, parseFailed: false };
|
|
149
153
|
}
|
|
150
154
|
catch (err) {
|
|
151
155
|
if (path)
|
|
@@ -163,7 +167,7 @@ function getCompiledMdxWithFallback(_a) {
|
|
|
163
167
|
throw fallbackResult.error;
|
|
164
168
|
}
|
|
165
169
|
fallbackResult.scope = Object.assign(Object.assign({}, fallbackResult.scope), { config: {} });
|
|
166
|
-
return fallbackResult;
|
|
170
|
+
return { result: fallbackResult, parseFailed: true };
|
|
167
171
|
}
|
|
168
172
|
});
|
|
169
173
|
}
|