@mintlify/cli 4.0.1528 → 4.0.1530

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.
@@ -886,6 +886,36 @@ function normalizeBlockContent(nodes2, schema) {
886
886
  import { Node } from "prosemirror-model";
887
887
  import { visit as visit2 } from "unist-util-visit";
888
888
 
889
+ // ../editor/dist/converter/parse/mdx-to-mdast.js
890
+ import { preprocessCustomHeadingIds } from "@mintlify/common";
891
+ import { remark } from "remark";
892
+ import remarkFrontmatter from "remark-frontmatter";
893
+ import remarkGfm from "remark-gfm";
894
+ import remarkMath from "remark-math";
895
+ import remarkMdx from "remark-mdx";
896
+ var coreRemark = remark().use(remarkMdx).use(remarkGfm).use(remarkFrontmatter, ["yaml", "toml"]).freeze();
897
+ var mathRemark = coreRemark().use(remarkMath).freeze();
898
+ function convertHtmlCommentsToJsx(mdx) {
899
+ const parts = mdx.split(/(```[\s\S]*?```|~~~[\s\S]*?~~~)/);
900
+ return parts.map((part, i) => i % 2 === 0 ? part.replace(/<!--([\s\S]*?)-->/g, (_m, c) => `{/* ${c} */}`) : part).join("");
901
+ }
902
+ function preprocessMdxSource(mdx, options = {}) {
903
+ var _a;
904
+ const sanitized = ((_a = options.omitHtmlComments) !== null && _a !== void 0 ? _a : true) ? convertHtmlCommentsToJsx(mdx) : mdx;
905
+ return {
906
+ sanitized,
907
+ preprocessed: preprocessCustomHeadingIds(sanitized, { preserveOriginal: true })
908
+ };
909
+ }
910
+ function parsePreprocessedMdx(preprocessed, math = true) {
911
+ return (math ? mathRemark : coreRemark)().parse(preprocessed);
912
+ }
913
+ function mdxToMdast(mdx, options = {
914
+ omitHtmlComments: true
915
+ }) {
916
+ return parsePreprocessedMdx(preprocessMdxSource(mdx, options).preprocessed, options.math);
917
+ }
918
+
889
919
  // ../editor/dist/converter/utils/mdx-attributes.js
890
920
  var EXPRESSION_ATTRS_KEY = "__expressionAttributes";
891
921
  var NAMED_EXPRESSION_ATTRS_KEY = "__namedExpressionAttributes";
@@ -996,6 +1026,16 @@ function parseMdxAttributes(attributes = [], options = {}) {
996
1026
  }
997
1027
  return parsed;
998
1028
  }
1029
+ function parseExpressionAttribute(raw) {
1030
+ try {
1031
+ const [node] = parsePreprocessedMdx(`<X value={${raw}} />`, false).children;
1032
+ if ((node === null || node === void 0 ? void 0 : node.type) !== "mdxJsxFlowElement" || node.attributes.length !== 1)
1033
+ return raw;
1034
+ return parseMdxAttributes(node.attributes).value;
1035
+ } catch (_a) {
1036
+ return raw;
1037
+ }
1038
+ }
999
1039
  var REACT_RESERVED_ATTRS = /* @__PURE__ */ new Set(["ref", "key", "dangerouslySetInnerHTML"]);
1000
1040
  function sanitizeDomAttrs(attrs2) {
1001
1041
  const named = attrs2[NAMED_EXPRESSION_ATTRS_KEY];
@@ -1255,38 +1295,6 @@ function convertToInlineImage(node) {
1255
1295
 
1256
1296
  // ../editor/dist/converter/parse/handlers/prompt.js
1257
1297
  import { SKIP, visit } from "unist-util-visit";
1258
-
1259
- // ../editor/dist/converter/parse/mdx-to-mdast.js
1260
- import { preprocessCustomHeadingIds } from "@mintlify/common";
1261
- import { remark } from "remark";
1262
- import remarkFrontmatter from "remark-frontmatter";
1263
- import remarkGfm from "remark-gfm";
1264
- import remarkMath from "remark-math";
1265
- import remarkMdx from "remark-mdx";
1266
- var coreRemark = remark().use(remarkMdx).use(remarkGfm).use(remarkFrontmatter, ["yaml", "toml"]).freeze();
1267
- var mathRemark = coreRemark().use(remarkMath).freeze();
1268
- function convertHtmlCommentsToJsx(mdx) {
1269
- const parts = mdx.split(/(```[\s\S]*?```|~~~[\s\S]*?~~~)/);
1270
- return parts.map((part, i) => i % 2 === 0 ? part.replace(/<!--([\s\S]*?)-->/g, (_m, c) => `{/* ${c} */}`) : part).join("");
1271
- }
1272
- function preprocessMdxSource(mdx, options = {}) {
1273
- var _a;
1274
- const sanitized = ((_a = options.omitHtmlComments) !== null && _a !== void 0 ? _a : true) ? convertHtmlCommentsToJsx(mdx) : mdx;
1275
- return {
1276
- sanitized,
1277
- preprocessed: preprocessCustomHeadingIds(sanitized, { preserveOriginal: true })
1278
- };
1279
- }
1280
- function parsePreprocessedMdx(preprocessed, math = true) {
1281
- return (math ? mathRemark : coreRemark)().parse(preprocessed);
1282
- }
1283
- function mdxToMdast(mdx, options = {
1284
- omitHtmlComments: true
1285
- }) {
1286
- return parsePreprocessedMdx(preprocessMdxSource(mdx, options).preprocessed, options.math);
1287
- }
1288
-
1289
- // ../editor/dist/converter/parse/handlers/prompt.js
1290
1298
  function handlePrompt(node, ctx, transformNode2) {
1291
1299
  var _a;
1292
1300
  const icon = readPromptAttr(node, "icon");
@@ -6468,6 +6476,7 @@ export {
6468
6476
  mintlifySchema,
6469
6477
  nodeSize,
6470
6478
  nodesMatch,
6479
+ parseExpressionAttribute,
6471
6480
  parseFrontmatterYaml,
6472
6481
  parseLineRanges,
6473
6482
  parseMdxAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1528",
3
+ "version": "4.0.1530",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -46,10 +46,10 @@
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
48
  "@mintlify/common": "1.0.1166",
49
- "@mintlify/link-rot": "3.0.1369",
49
+ "@mintlify/link-rot": "3.0.1370",
50
50
  "@mintlify/models": "0.0.361",
51
- "@mintlify/prebuild": "1.0.1321",
52
- "@mintlify/previewing": "4.0.1393",
51
+ "@mintlify/prebuild": "1.0.1322",
52
+ "@mintlify/previewing": "4.0.1394",
53
53
  "@mintlify/validation": "0.1.869",
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.411",
89
+ "@mintlify/editor": "0.0.412",
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": "dd62ac0de90eabc5d35842d4030000e494787d6a"
108
+ "gitHead": "5273fce0f218cb475e78a9db77622d699cfb0ecd"
109
109
  }