@mintlify/cli 4.0.1448 → 4.0.1449
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/bin/vendor/converter.js +107 -123
- package/package.json +3 -3
package/bin/vendor/converter.js
CHANGED
|
@@ -997,6 +997,109 @@ function partitionAttrs(parsed, known, consumed = []) {
|
|
|
997
997
|
return result;
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
+
// ../editor/dist/converter/parse/parse-utils.js
|
|
1001
|
+
import { parse as parseYaml } from "yaml";
|
|
1002
|
+
function extractFrontmatter(mdast) {
|
|
1003
|
+
const yamlNode = mdast.children.find((n) => n.type === "yaml");
|
|
1004
|
+
if (!yamlNode || !("value" in yamlNode))
|
|
1005
|
+
return {};
|
|
1006
|
+
try {
|
|
1007
|
+
const parsed = parseYaml(yamlNode.value);
|
|
1008
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1009
|
+
return parsed;
|
|
1010
|
+
}
|
|
1011
|
+
} catch (_a) {
|
|
1012
|
+
}
|
|
1013
|
+
return {};
|
|
1014
|
+
}
|
|
1015
|
+
function createTextNode(value, marks2 = []) {
|
|
1016
|
+
if (!value)
|
|
1017
|
+
return { type: "text", text: "" };
|
|
1018
|
+
return Object.assign({ type: "text", text: value }, marks2.length > 0 && { marks: marks2 });
|
|
1019
|
+
}
|
|
1020
|
+
function extractTextFromNode(node) {
|
|
1021
|
+
if (!node)
|
|
1022
|
+
return { text: "", marks: [] };
|
|
1023
|
+
if (node.type === "text" || node.type === "inlineCode") {
|
|
1024
|
+
return { text: ("value" in node ? node.value : "") || "", marks: getMarks(node) };
|
|
1025
|
+
}
|
|
1026
|
+
if ("children" in node && Array.isArray(node.children)) {
|
|
1027
|
+
let text = "";
|
|
1028
|
+
const marks2 = getMarks(node);
|
|
1029
|
+
for (const child of node.children) {
|
|
1030
|
+
const { text: childText, marks: childMarks } = extractTextFromNode(child);
|
|
1031
|
+
text += childText;
|
|
1032
|
+
marks2.push(...childMarks);
|
|
1033
|
+
}
|
|
1034
|
+
return { text, marks: marks2 };
|
|
1035
|
+
}
|
|
1036
|
+
return { text: "", marks: [] };
|
|
1037
|
+
}
|
|
1038
|
+
function getMarks(node) {
|
|
1039
|
+
const marks2 = [];
|
|
1040
|
+
if (!node)
|
|
1041
|
+
return marks2;
|
|
1042
|
+
switch (node.type) {
|
|
1043
|
+
case "link":
|
|
1044
|
+
marks2.push({
|
|
1045
|
+
type: "link",
|
|
1046
|
+
attrs: {
|
|
1047
|
+
href: node.url,
|
|
1048
|
+
title: node.title || void 0
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
break;
|
|
1052
|
+
case "inlineCode":
|
|
1053
|
+
marks2.push({ type: "code" });
|
|
1054
|
+
break;
|
|
1055
|
+
case "emphasis":
|
|
1056
|
+
marks2.push({ type: "italic" });
|
|
1057
|
+
break;
|
|
1058
|
+
case "strong":
|
|
1059
|
+
marks2.push({ type: "bold" });
|
|
1060
|
+
break;
|
|
1061
|
+
case "delete":
|
|
1062
|
+
marks2.push({ type: "strike" });
|
|
1063
|
+
break;
|
|
1064
|
+
case "mdxJsxTextElement":
|
|
1065
|
+
if (node.name === "u")
|
|
1066
|
+
marks2.push({ type: "underline" });
|
|
1067
|
+
else if (node.name === "sub")
|
|
1068
|
+
marks2.push({ type: "subscript" });
|
|
1069
|
+
else if (node.name === "sup")
|
|
1070
|
+
marks2.push({ type: "superscript" });
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
return marks2;
|
|
1074
|
+
}
|
|
1075
|
+
function isInlineNode(node, schema2) {
|
|
1076
|
+
var _a;
|
|
1077
|
+
return ((_a = schema2.nodes[node.type]) === null || _a === void 0 ? void 0 : _a.isInline) === true;
|
|
1078
|
+
}
|
|
1079
|
+
function normalizeBlockContent(nodes2, schema2) {
|
|
1080
|
+
const normalized = [];
|
|
1081
|
+
let pendingInlineContent = [];
|
|
1082
|
+
const flushPendingInlineContent = () => {
|
|
1083
|
+
if (pendingInlineContent.length === 0)
|
|
1084
|
+
return;
|
|
1085
|
+
normalized.push({
|
|
1086
|
+
type: "paragraph",
|
|
1087
|
+
content: pendingInlineContent
|
|
1088
|
+
});
|
|
1089
|
+
pendingInlineContent = [];
|
|
1090
|
+
};
|
|
1091
|
+
for (const node of nodes2) {
|
|
1092
|
+
if (isInlineNode(node, schema2)) {
|
|
1093
|
+
pendingInlineContent.push(node);
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
flushPendingInlineContent();
|
|
1097
|
+
normalized.push(node);
|
|
1098
|
+
}
|
|
1099
|
+
flushPendingInlineContent();
|
|
1100
|
+
return normalized;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1000
1103
|
// ../editor/dist/converter/parse/handlers/callout.js
|
|
1001
1104
|
var CALLOUT_NON_TYPE_ATTRS = CALLOUT_ATTRS.filter((d) => d.name !== "type");
|
|
1002
1105
|
function canonicalCalloutType(value) {
|
|
@@ -1240,109 +1343,6 @@ function mdxToMdast(mdx, options = {
|
|
|
1240
1343
|
return parser().parse(preprocessCustomHeadingIds(sanitized, { preserveOriginal: true }));
|
|
1241
1344
|
}
|
|
1242
1345
|
|
|
1243
|
-
// ../editor/dist/converter/parse/parse-utils.js
|
|
1244
|
-
import { parse as parseYaml } from "yaml";
|
|
1245
|
-
function extractFrontmatter(mdast) {
|
|
1246
|
-
const yamlNode = mdast.children.find((n) => n.type === "yaml");
|
|
1247
|
-
if (!yamlNode || !("value" in yamlNode))
|
|
1248
|
-
return {};
|
|
1249
|
-
try {
|
|
1250
|
-
const parsed = parseYaml(yamlNode.value);
|
|
1251
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1252
|
-
return parsed;
|
|
1253
|
-
}
|
|
1254
|
-
} catch (_a) {
|
|
1255
|
-
}
|
|
1256
|
-
return {};
|
|
1257
|
-
}
|
|
1258
|
-
function createTextNode(value, marks2 = []) {
|
|
1259
|
-
if (!value)
|
|
1260
|
-
return { type: "text", text: "" };
|
|
1261
|
-
return Object.assign({ type: "text", text: value }, marks2.length > 0 && { marks: marks2 });
|
|
1262
|
-
}
|
|
1263
|
-
function extractTextFromNode(node) {
|
|
1264
|
-
if (!node)
|
|
1265
|
-
return { text: "", marks: [] };
|
|
1266
|
-
if (node.type === "text" || node.type === "inlineCode") {
|
|
1267
|
-
return { text: ("value" in node ? node.value : "") || "", marks: getMarks(node) };
|
|
1268
|
-
}
|
|
1269
|
-
if ("children" in node && Array.isArray(node.children)) {
|
|
1270
|
-
let text = "";
|
|
1271
|
-
const marks2 = getMarks(node);
|
|
1272
|
-
for (const child of node.children) {
|
|
1273
|
-
const { text: childText, marks: childMarks } = extractTextFromNode(child);
|
|
1274
|
-
text += childText;
|
|
1275
|
-
marks2.push(...childMarks);
|
|
1276
|
-
}
|
|
1277
|
-
return { text, marks: marks2 };
|
|
1278
|
-
}
|
|
1279
|
-
return { text: "", marks: [] };
|
|
1280
|
-
}
|
|
1281
|
-
function getMarks(node) {
|
|
1282
|
-
const marks2 = [];
|
|
1283
|
-
if (!node)
|
|
1284
|
-
return marks2;
|
|
1285
|
-
switch (node.type) {
|
|
1286
|
-
case "link":
|
|
1287
|
-
marks2.push({
|
|
1288
|
-
type: "link",
|
|
1289
|
-
attrs: {
|
|
1290
|
-
href: node.url,
|
|
1291
|
-
title: node.title || void 0
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
break;
|
|
1295
|
-
case "inlineCode":
|
|
1296
|
-
marks2.push({ type: "code" });
|
|
1297
|
-
break;
|
|
1298
|
-
case "emphasis":
|
|
1299
|
-
marks2.push({ type: "italic" });
|
|
1300
|
-
break;
|
|
1301
|
-
case "strong":
|
|
1302
|
-
marks2.push({ type: "bold" });
|
|
1303
|
-
break;
|
|
1304
|
-
case "delete":
|
|
1305
|
-
marks2.push({ type: "strike" });
|
|
1306
|
-
break;
|
|
1307
|
-
case "mdxJsxTextElement":
|
|
1308
|
-
if (node.name === "u")
|
|
1309
|
-
marks2.push({ type: "underline" });
|
|
1310
|
-
else if (node.name === "sub")
|
|
1311
|
-
marks2.push({ type: "subscript" });
|
|
1312
|
-
else if (node.name === "sup")
|
|
1313
|
-
marks2.push({ type: "superscript" });
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
return marks2;
|
|
1317
|
-
}
|
|
1318
|
-
function isInlineNode(node, schema2) {
|
|
1319
|
-
var _a;
|
|
1320
|
-
return ((_a = schema2.nodes[node.type]) === null || _a === void 0 ? void 0 : _a.isInline) === true;
|
|
1321
|
-
}
|
|
1322
|
-
function normalizeBlockContent(nodes2, schema2) {
|
|
1323
|
-
const normalized = [];
|
|
1324
|
-
let pendingInlineContent = [];
|
|
1325
|
-
const flushPendingInlineContent = () => {
|
|
1326
|
-
if (pendingInlineContent.length === 0)
|
|
1327
|
-
return;
|
|
1328
|
-
normalized.push({
|
|
1329
|
-
type: "paragraph",
|
|
1330
|
-
content: pendingInlineContent
|
|
1331
|
-
});
|
|
1332
|
-
pendingInlineContent = [];
|
|
1333
|
-
};
|
|
1334
|
-
for (const node of nodes2) {
|
|
1335
|
-
if (isInlineNode(node, schema2)) {
|
|
1336
|
-
pendingInlineContent.push(node);
|
|
1337
|
-
continue;
|
|
1338
|
-
}
|
|
1339
|
-
flushPendingInlineContent();
|
|
1340
|
-
normalized.push(node);
|
|
1341
|
-
}
|
|
1342
|
-
flushPendingInlineContent();
|
|
1343
|
-
return normalized;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
1346
|
// ../editor/dist/converter/parse/handlers/prompt.js
|
|
1347
1347
|
function handlePrompt(node, ctx, transformNode2) {
|
|
1348
1348
|
var _a;
|
|
@@ -1888,15 +1888,6 @@ function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
1888
1888
|
});
|
|
1889
1889
|
return { type: "table", content: tableContent };
|
|
1890
1890
|
}
|
|
1891
|
-
var TABLE_BLOCK_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
1892
|
-
"paragraph",
|
|
1893
|
-
"heading",
|
|
1894
|
-
"bulletList",
|
|
1895
|
-
"orderedList",
|
|
1896
|
-
"blockquote",
|
|
1897
|
-
BLOCK_TYPES.codeBlock,
|
|
1898
|
-
"table"
|
|
1899
|
-
]);
|
|
1900
1891
|
function flattenPmContent(content) {
|
|
1901
1892
|
return Array.isArray(content) ? content.filter(Boolean) : [content];
|
|
1902
1893
|
}
|
|
@@ -1925,14 +1916,7 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
|
|
|
1925
1916
|
const result = [];
|
|
1926
1917
|
for (const child of cell.children) {
|
|
1927
1918
|
if (child.type !== "mdxJsxFlowElement" && child.type !== "mdxJsxTextElement") {
|
|
1928
|
-
|
|
1929
|
-
if (items.length > 0) {
|
|
1930
|
-
if (items.length === 1 && ((_a = items[0]) === null || _a === void 0 ? void 0 : _a.type) && TABLE_BLOCK_NODE_TYPES.has(items[0].type)) {
|
|
1931
|
-
result.push(items[0]);
|
|
1932
|
-
} else {
|
|
1933
|
-
result.push({ type: "paragraph", content: items });
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1919
|
+
result.push(...flattenPmContent(transformNode2(child, ctx)));
|
|
1936
1920
|
continue;
|
|
1937
1921
|
}
|
|
1938
1922
|
if (child.name === "p") {
|
|
@@ -1943,11 +1927,11 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
|
|
|
1943
1927
|
continue;
|
|
1944
1928
|
}
|
|
1945
1929
|
if (child.name && /^h[1-6]$/.test(child.name)) {
|
|
1946
|
-
const level = parseInt((
|
|
1930
|
+
const level = parseInt((_a = child.name[1]) !== null && _a !== void 0 ? _a : "1", 10);
|
|
1947
1931
|
const headingAttrs = parseMdxAttributes(child.attributes);
|
|
1948
1932
|
result.push({
|
|
1949
1933
|
type: "heading",
|
|
1950
|
-
attrs: { level, id: (
|
|
1934
|
+
attrs: { level, id: (_b = headingAttrs.id) !== null && _b !== void 0 ? _b : null },
|
|
1951
1935
|
content: mapTableJsxElementChildren(child, ctx, transformNode2, mapJsxChildren2)
|
|
1952
1936
|
});
|
|
1953
1937
|
continue;
|
|
@@ -1972,7 +1956,7 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
|
|
|
1972
1956
|
}
|
|
1973
1957
|
result.push(...flattenPmContent(transformNode2(child, ctx)));
|
|
1974
1958
|
}
|
|
1975
|
-
return result;
|
|
1959
|
+
return normalizeBlockContent(result, (_c = ctx.schema) !== null && _c !== void 0 ? _c : mintlifySchema);
|
|
1976
1960
|
}
|
|
1977
1961
|
function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2) {
|
|
1978
1962
|
if (node.type === "mdxJsxFlowElement") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1449",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"keytar": "7.9.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@mintlify/editor": "0.0.
|
|
89
|
+
"@mintlify/editor": "0.0.339",
|
|
90
90
|
"@mintlify/ts-config": "2.0.2",
|
|
91
91
|
"@tsconfig/recommended": "1.0.2",
|
|
92
92
|
"@types/detect-port": "1.3.2",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"vitest": "2.1.9",
|
|
106
106
|
"vitest-mock-process": "1.0.4"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "3841674841fd67559df5b42dbacd7f1b1d7955b4"
|
|
109
109
|
}
|