@mintlify/cli 4.0.1447 → 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.
@@ -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,82 +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
-
1319
1346
  // ../editor/dist/converter/parse/handlers/prompt.js
1320
1347
  function handlePrompt(node, ctx, transformNode2) {
1321
1348
  var _a;
@@ -1861,15 +1888,6 @@ function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
1861
1888
  });
1862
1889
  return { type: "table", content: tableContent };
1863
1890
  }
1864
- var TABLE_BLOCK_NODE_TYPES = /* @__PURE__ */ new Set([
1865
- "paragraph",
1866
- "heading",
1867
- "bulletList",
1868
- "orderedList",
1869
- "blockquote",
1870
- BLOCK_TYPES.codeBlock,
1871
- "table"
1872
- ]);
1873
1891
  function flattenPmContent(content) {
1874
1892
  return Array.isArray(content) ? content.filter(Boolean) : [content];
1875
1893
  }
@@ -1898,14 +1916,7 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
1898
1916
  const result = [];
1899
1917
  for (const child of cell.children) {
1900
1918
  if (child.type !== "mdxJsxFlowElement" && child.type !== "mdxJsxTextElement") {
1901
- const items = flattenPmContent(transformNode2(child, ctx));
1902
- if (items.length > 0) {
1903
- if (items.length === 1 && ((_a = items[0]) === null || _a === void 0 ? void 0 : _a.type) && TABLE_BLOCK_NODE_TYPES.has(items[0].type)) {
1904
- result.push(items[0]);
1905
- } else {
1906
- result.push({ type: "paragraph", content: items });
1907
- }
1908
- }
1919
+ result.push(...flattenPmContent(transformNode2(child, ctx)));
1909
1920
  continue;
1910
1921
  }
1911
1922
  if (child.name === "p") {
@@ -1916,11 +1927,11 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
1916
1927
  continue;
1917
1928
  }
1918
1929
  if (child.name && /^h[1-6]$/.test(child.name)) {
1919
- const level = parseInt((_b = child.name[1]) !== null && _b !== void 0 ? _b : "1", 10);
1930
+ const level = parseInt((_a = child.name[1]) !== null && _a !== void 0 ? _a : "1", 10);
1920
1931
  const headingAttrs = parseMdxAttributes(child.attributes);
1921
1932
  result.push({
1922
1933
  type: "heading",
1923
- attrs: { level, id: (_c = headingAttrs.id) !== null && _c !== void 0 ? _c : null },
1934
+ attrs: { level, id: (_b = headingAttrs.id) !== null && _b !== void 0 ? _b : null },
1924
1935
  content: mapTableJsxElementChildren(child, ctx, transformNode2, mapJsxChildren2)
1925
1936
  });
1926
1937
  continue;
@@ -1945,7 +1956,7 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
1945
1956
  }
1946
1957
  result.push(...flattenPmContent(transformNode2(child, ctx)));
1947
1958
  }
1948
- return result;
1959
+ return normalizeBlockContent(result, (_c = ctx.schema) !== null && _c !== void 0 ? _c : mintlifySchema);
1949
1960
  }
1950
1961
  function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2) {
1951
1962
  if (node.type === "mdxJsxFlowElement") {
@@ -1959,6 +1970,7 @@ function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2)
1959
1970
 
1960
1971
  // ../editor/dist/converter/parse/handlers/inline-jsx.js
1961
1972
  function handleInlineJsx(node, ctx, mapChildren2) {
1973
+ var _a;
1962
1974
  if (node.name === "Tooltip") {
1963
1975
  const attrs2 = partitionAttrs(parseMdxAttributes(node.attributes), TOOLTIP_ATTRS);
1964
1976
  const content = mapChildren2(node, ctx);
@@ -2017,7 +2029,7 @@ function handleInlineJsx(node, ctx, mapChildren2) {
2017
2029
  name: node.name,
2018
2030
  attributes: parseMdxAttributes(node.attributes)
2019
2031
  },
2020
- content: mapChildren2(node, ctx)
2032
+ content: normalizeBlockContent(mapChildren2(node, ctx), (_a = ctx.schema) !== null && _a !== void 0 ? _a : mintlifySchema)
2021
2033
  };
2022
2034
  }
2023
2035
  if (node.name && HTML_ELEMENTS.has(node.name)) {
@@ -2648,33 +2660,6 @@ function mapChildren(node, ctx) {
2648
2660
  const nodes2 = node.children.flatMap((child) => transformNode(child, ctx)).filter(Boolean);
2649
2661
  return mergeDarkLightImagePairs(nodes2);
2650
2662
  }
2651
- function normalizeBlockContent(nodes2, schema2) {
2652
- const normalized = [];
2653
- let pendingInlineContent = [];
2654
- const flushPendingInlineContent = () => {
2655
- if (pendingInlineContent.length === 0)
2656
- return;
2657
- normalized.push({
2658
- type: "paragraph",
2659
- content: pendingInlineContent
2660
- });
2661
- pendingInlineContent = [];
2662
- };
2663
- for (const node of nodes2) {
2664
- if (isInlineNode(node, schema2)) {
2665
- pendingInlineContent.push(node);
2666
- continue;
2667
- }
2668
- flushPendingInlineContent();
2669
- normalized.push(node);
2670
- }
2671
- flushPendingInlineContent();
2672
- return normalized;
2673
- }
2674
- function isInlineNode(node, schema2) {
2675
- const nodeType = schema2.nodes[node.type];
2676
- return (nodeType === null || nodeType === void 0 ? void 0 : nodeType.isInline) === true;
2677
- }
2678
2663
  function mapJsxChildren(node, ctx) {
2679
2664
  var _a;
2680
2665
  const nodes2 = flattenJsxParagraphs({ children: node.children }).children.flatMap((child) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1447",
3
+ "version": "4.0.1449",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -45,11 +45,11 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
- "@mintlify/common": "1.0.1117",
49
- "@mintlify/link-rot": "3.0.1319",
48
+ "@mintlify/common": "1.0.1118",
49
+ "@mintlify/link-rot": "3.0.1320",
50
50
  "@mintlify/models": "0.0.351",
51
- "@mintlify/prebuild": "1.0.1271",
52
- "@mintlify/previewing": "4.0.1343",
51
+ "@mintlify/prebuild": "1.0.1272",
52
+ "@mintlify/previewing": "4.0.1344",
53
53
  "@mintlify/validation": "0.1.842",
54
54
  "adm-zip": "0.6.0",
55
55
  "chalk": "5.2.0",
@@ -86,7 +86,7 @@
86
86
  "keytar": "7.9.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@mintlify/editor": "0.0.337",
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": "02bf74b3c59a62b384c31182f6ecbdb7fef496f9"
108
+ "gitHead": "3841674841fd67559df5b42dbacd7f1b1d7955b4"
109
109
  }