@mintlify/cli 4.0.1501 → 4.0.1503

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.
@@ -843,6 +843,112 @@ function createSchema(extra) {
843
843
  return new Schema({ nodes: mergedNodes, marks: mergedMarks });
844
844
  }
845
845
 
846
+ // ../editor/dist/converter/parse/parse-utils.js
847
+ import { parse as parseYaml } from "yaml";
848
+ function parseFrontmatterYaml(value) {
849
+ try {
850
+ const parsed = parseYaml(value);
851
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
852
+ return parsed;
853
+ }
854
+ } catch (_a) {
855
+ }
856
+ return {};
857
+ }
858
+ function extractFrontmatter(mdast) {
859
+ const yamlNode = mdast.children.find((n) => n.type === "yaml");
860
+ if (!yamlNode || !("value" in yamlNode))
861
+ return {};
862
+ return parseFrontmatterYaml(yamlNode.value);
863
+ }
864
+ function createTextNode(value, marks2 = []) {
865
+ if (!value)
866
+ return { type: "text", text: "" };
867
+ return Object.assign({ type: "text", text: value }, marks2.length > 0 && { marks: marks2 });
868
+ }
869
+ function extractTextFromNode(node) {
870
+ if (!node)
871
+ return { text: "", marks: [] };
872
+ if (node.type === "text" || node.type === "inlineCode") {
873
+ return { text: ("value" in node ? node.value : "") || "", marks: getMarks(node) };
874
+ }
875
+ if ("children" in node && Array.isArray(node.children)) {
876
+ let text = "";
877
+ const marks2 = getMarks(node);
878
+ for (const child of node.children) {
879
+ const { text: childText, marks: childMarks } = extractTextFromNode(child);
880
+ text += childText;
881
+ marks2.push(...childMarks);
882
+ }
883
+ return { text, marks: marks2 };
884
+ }
885
+ return { text: "", marks: [] };
886
+ }
887
+ function getMarks(node) {
888
+ const marks2 = [];
889
+ if (!node)
890
+ return marks2;
891
+ switch (node.type) {
892
+ case "link":
893
+ marks2.push({
894
+ type: "link",
895
+ attrs: {
896
+ href: node.url,
897
+ title: node.title || void 0
898
+ }
899
+ });
900
+ break;
901
+ case "inlineCode":
902
+ marks2.push({ type: "code" });
903
+ break;
904
+ case "emphasis":
905
+ marks2.push({ type: "italic" });
906
+ break;
907
+ case "strong":
908
+ marks2.push({ type: "bold" });
909
+ break;
910
+ case "delete":
911
+ marks2.push({ type: "strike" });
912
+ break;
913
+ case "mdxJsxTextElement":
914
+ if (node.name === "u")
915
+ marks2.push({ type: "underline" });
916
+ else if (node.name === "sub")
917
+ marks2.push({ type: "subscript" });
918
+ else if (node.name === "sup")
919
+ marks2.push({ type: "superscript" });
920
+ break;
921
+ }
922
+ return marks2;
923
+ }
924
+ function isInlineNode(node, schema) {
925
+ var _a;
926
+ return ((_a = schema.nodes[node.type]) === null || _a === void 0 ? void 0 : _a.isInline) === true;
927
+ }
928
+ function normalizeBlockContent(nodes2, schema) {
929
+ const normalized = [];
930
+ let pendingInlineContent = [];
931
+ const flushPendingInlineContent = () => {
932
+ if (pendingInlineContent.length === 0)
933
+ return;
934
+ normalized.push({
935
+ type: "paragraph",
936
+ content: pendingInlineContent
937
+ });
938
+ pendingInlineContent = [];
939
+ };
940
+ for (const node of nodes2) {
941
+ if (isInlineNode(node, schema)) {
942
+ pendingInlineContent.push(node);
943
+ continue;
944
+ }
945
+ flushPendingInlineContent();
946
+ normalized.push(node);
947
+ }
948
+ flushPendingInlineContent();
949
+ return normalized;
950
+ }
951
+
846
952
  // ../editor/dist/converter/parse/mdast-to-pm.js
847
953
  import { Node } from "prosemirror-model";
848
954
  import { visit as visit2 } from "unist-util-visit";
@@ -999,109 +1105,6 @@ function partitionAttrs(parsed, known, consumed = []) {
999
1105
  // ../editor/dist/converter/parse/handlers/flow-jsx.js
1000
1106
  import { parseTitleMarkdown } from "@mintlify/common/title-markdown";
1001
1107
 
1002
- // ../editor/dist/converter/parse/parse-utils.js
1003
- import { parse as parseYaml } from "yaml";
1004
- function extractFrontmatter(mdast) {
1005
- const yamlNode = mdast.children.find((n) => n.type === "yaml");
1006
- if (!yamlNode || !("value" in yamlNode))
1007
- return {};
1008
- try {
1009
- const parsed = parseYaml(yamlNode.value);
1010
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1011
- return parsed;
1012
- }
1013
- } catch (_a) {
1014
- }
1015
- return {};
1016
- }
1017
- function createTextNode(value, marks2 = []) {
1018
- if (!value)
1019
- return { type: "text", text: "" };
1020
- return Object.assign({ type: "text", text: value }, marks2.length > 0 && { marks: marks2 });
1021
- }
1022
- function extractTextFromNode(node) {
1023
- if (!node)
1024
- return { text: "", marks: [] };
1025
- if (node.type === "text" || node.type === "inlineCode") {
1026
- return { text: ("value" in node ? node.value : "") || "", marks: getMarks(node) };
1027
- }
1028
- if ("children" in node && Array.isArray(node.children)) {
1029
- let text = "";
1030
- const marks2 = getMarks(node);
1031
- for (const child of node.children) {
1032
- const { text: childText, marks: childMarks } = extractTextFromNode(child);
1033
- text += childText;
1034
- marks2.push(...childMarks);
1035
- }
1036
- return { text, marks: marks2 };
1037
- }
1038
- return { text: "", marks: [] };
1039
- }
1040
- function getMarks(node) {
1041
- const marks2 = [];
1042
- if (!node)
1043
- return marks2;
1044
- switch (node.type) {
1045
- case "link":
1046
- marks2.push({
1047
- type: "link",
1048
- attrs: {
1049
- href: node.url,
1050
- title: node.title || void 0
1051
- }
1052
- });
1053
- break;
1054
- case "inlineCode":
1055
- marks2.push({ type: "code" });
1056
- break;
1057
- case "emphasis":
1058
- marks2.push({ type: "italic" });
1059
- break;
1060
- case "strong":
1061
- marks2.push({ type: "bold" });
1062
- break;
1063
- case "delete":
1064
- marks2.push({ type: "strike" });
1065
- break;
1066
- case "mdxJsxTextElement":
1067
- if (node.name === "u")
1068
- marks2.push({ type: "underline" });
1069
- else if (node.name === "sub")
1070
- marks2.push({ type: "subscript" });
1071
- else if (node.name === "sup")
1072
- marks2.push({ type: "superscript" });
1073
- break;
1074
- }
1075
- return marks2;
1076
- }
1077
- function isInlineNode(node, schema) {
1078
- var _a;
1079
- return ((_a = schema.nodes[node.type]) === null || _a === void 0 ? void 0 : _a.isInline) === true;
1080
- }
1081
- function normalizeBlockContent(nodes2, schema) {
1082
- const normalized = [];
1083
- let pendingInlineContent = [];
1084
- const flushPendingInlineContent = () => {
1085
- if (pendingInlineContent.length === 0)
1086
- return;
1087
- normalized.push({
1088
- type: "paragraph",
1089
- content: pendingInlineContent
1090
- });
1091
- pendingInlineContent = [];
1092
- };
1093
- for (const node of nodes2) {
1094
- if (isInlineNode(node, schema)) {
1095
- pendingInlineContent.push(node);
1096
- continue;
1097
- }
1098
- flushPendingInlineContent();
1099
- normalized.push(node);
1100
- }
1101
- flushPendingInlineContent();
1102
- return normalized;
1103
- }
1104
-
1105
1108
  // ../editor/dist/converter/parse/handlers/callout.js
1106
1109
  var CALLOUT_NON_TYPE_ATTRS = CALLOUT_ATTRS.filter((d) => d.name !== "type");
1107
1110
  function canonicalCalloutType(value) {
@@ -6512,6 +6515,7 @@ export {
6512
6515
  deepEqual,
6513
6516
  diffDocs,
6514
6517
  extractDiffMarkers,
6518
+ extractFrontmatter,
6515
6519
  extractText,
6516
6520
  filterFrontmatterRecord,
6517
6521
  formatFrontmatterValue,
@@ -6529,6 +6533,7 @@ export {
6529
6533
  mintlifySchema,
6530
6534
  nodeSize,
6531
6535
  nodesMatch,
6536
+ parseFrontmatterYaml,
6532
6537
  parseLineRanges,
6533
6538
  parseMdxAttributes,
6534
6539
  parseMetaString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1501",
3
+ "version": "4.0.1503",
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.385",
89
+ "@mintlify/editor": "0.0.387",
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": "bf590b18aaa3c5c437b56df398f1975d501bb920"
108
+ "gitHead": "978c4ed97686a468335d398c42b74a777694f486"
109
109
  }