@mintlify/cli 4.0.1498 → 4.0.1500

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.
@@ -852,7 +852,7 @@ var EXPRESSION_ATTRS_KEY = "__expressionAttributes";
852
852
  var NAMED_EXPRESSION_ATTRS_KEY = "__namedExpressionAttributes";
853
853
  var EXTRA_ATTRS_KEY = "__mintlifyExtraAttrs";
854
854
  var UNSUPPORTED_ESTREE = Symbol("unsupported-estree");
855
- function convertEstreeLiteral(node) {
855
+ function convertEstreeLiteral(node, staticOnly) {
856
856
  var _a, _b;
857
857
  if (!node)
858
858
  return UNSUPPORTED_ESTREE;
@@ -865,11 +865,13 @@ function convertEstreeLiteral(node) {
865
865
  }
866
866
  return UNSUPPORTED_ESTREE;
867
867
  case "Identifier":
868
+ if (staticOnly)
869
+ return UNSUPPORTED_ESTREE;
868
870
  if (node.name === "undefined")
869
871
  return void 0;
870
872
  return node.name;
871
873
  case "UnaryExpression": {
872
- const argument = convertEstreeLiteral(node.argument);
874
+ const argument = convertEstreeLiteral(node.argument, staticOnly);
873
875
  if (typeof argument !== "number")
874
876
  return UNSUPPORTED_ESTREE;
875
877
  if (node.operator === "-")
@@ -883,7 +885,7 @@ function convertEstreeLiteral(node) {
883
885
  for (const element of node.elements) {
884
886
  if (!element || element.type === "SpreadElement")
885
887
  return UNSUPPORTED_ESTREE;
886
- const parsed = convertEstreeLiteral(element);
888
+ const parsed = convertEstreeLiteral(element, staticOnly);
887
889
  if (parsed === UNSUPPORTED_ESTREE)
888
890
  return UNSUPPORTED_ESTREE;
889
891
  values.push(parsed);
@@ -900,7 +902,7 @@ function convertEstreeLiteral(node) {
900
902
  const key = typedProperty.key.type === "Identifier" ? typedProperty.key.name : typedProperty.key.type === "Literal" && (typeof typedProperty.key.value === "string" || typeof typedProperty.key.value === "number") ? String(typedProperty.key.value) : void 0;
901
903
  if (!key)
902
904
  return UNSUPPORTED_ESTREE;
903
- const value = typedProperty.shorthand ? typedProperty.key.type === "Identifier" ? convertEstreeLiteral(typedProperty.key) : UNSUPPORTED_ESTREE : convertEstreeLiteral(typedProperty.value);
905
+ const value = typedProperty.shorthand ? typedProperty.key.type === "Identifier" ? convertEstreeLiteral(typedProperty.key, staticOnly) : UNSUPPORTED_ESTREE : convertEstreeLiteral(typedProperty.value, staticOnly);
904
906
  if (value === UNSUPPORTED_ESTREE)
905
907
  return UNSUPPORTED_ESTREE;
906
908
  obj[key] = value;
@@ -911,10 +913,10 @@ function convertEstreeLiteral(node) {
911
913
  return UNSUPPORTED_ESTREE;
912
914
  }
913
915
  }
914
- function parseExpressionValue(raw, estree) {
916
+ function parseExpressionValue(raw, estree, staticOnly) {
915
917
  const firstStatement = estree === null || estree === void 0 ? void 0 : estree.body[0];
916
918
  const expression = (firstStatement === null || firstStatement === void 0 ? void 0 : firstStatement.type) === "ExpressionStatement" ? firstStatement.expression : void 0;
917
- const parsed = convertEstreeLiteral(expression);
919
+ const parsed = convertEstreeLiteral(expression, staticOnly);
918
920
  if (parsed !== UNSUPPORTED_ESTREE)
919
921
  return parsed;
920
922
  if (raw.trim() !== "" && !Number.isNaN(Number(raw))) {
@@ -922,8 +924,8 @@ function parseExpressionValue(raw, estree) {
922
924
  }
923
925
  return raw;
924
926
  }
925
- function parseMdxAttributes(attributes = []) {
926
- var _a, _b;
927
+ function parseMdxAttributes(attributes = [], options = {}) {
928
+ var _a, _b, _c;
927
929
  const parsed = {};
928
930
  const expressionAttrs = [];
929
931
  const namedExpressionAttrs = {};
@@ -937,7 +939,7 @@ function parseMdxAttributes(attributes = []) {
937
939
  const raw = value.value;
938
940
  if (typeof raw === "string") {
939
941
  namedExpressionAttrs[attr.name] = raw;
940
- parsed[attr.name] = parseExpressionValue(raw, "data" in value ? (_b = (_a = value.data) === null || _a === void 0 ? void 0 : _a.estree) !== null && _b !== void 0 ? _b : void 0 : void 0);
942
+ parsed[attr.name] = parseExpressionValue(raw, "data" in value ? (_b = (_a = value.data) === null || _a === void 0 ? void 0 : _a.estree) !== null && _b !== void 0 ? _b : void 0 : void 0, (_c = options.staticOnly) !== null && _c !== void 0 ? _c : false);
941
943
  } else {
942
944
  parsed[attr.name] = raw;
943
945
  }
@@ -1398,40 +1400,21 @@ function handlePrompt(node, ctx, transformNode2) {
1398
1400
  };
1399
1401
  }
1400
1402
  function readPromptAttr(node, name) {
1401
- const attr = node.attributes.find((a) => a.type === "mdxJsxAttribute" && a.name === name);
1402
- if (!attr)
1403
+ const value = parseMdxAttributes(node.attributes)[name];
1404
+ if (typeof value !== "string")
1403
1405
  return void 0;
1404
- if (typeof attr.value === "string")
1405
- return attr.value;
1406
- if (attr.value && typeof attr.value === "object" && "value" in attr.value) {
1407
- if (typeof attr.value.value !== "string")
1408
- return void 0;
1409
- const raw = attr.value.value.trim();
1406
+ const attr = node.attributes.find((attr2) => attr2.type === "mdxJsxAttribute" && attr2.name === name);
1407
+ if ((attr === null || attr === void 0 ? void 0 : attr.type) === "mdxJsxAttribute" && attr.value !== null && typeof attr.value === "object" && value === attr.value.value) {
1408
+ const raw = value.trim();
1410
1409
  if (raw.startsWith("`") && raw.endsWith("`")) {
1411
1410
  return raw.slice(1, -1).replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\\/g, "\\");
1412
1411
  }
1413
- try {
1414
- const parsed = JSON.parse(raw);
1415
- if (typeof parsed === "string")
1416
- return parsed;
1417
- } catch (_a) {
1418
- }
1419
- return raw;
1420
1412
  }
1421
- return void 0;
1413
+ return value;
1422
1414
  }
1423
1415
  function readPromptActions(node) {
1424
- const attr = node.attributes.find((a) => a.type === "mdxJsxAttribute" && a.name === "actions");
1425
- if (!(attr === null || attr === void 0 ? void 0 : attr.value) || typeof attr.value !== "object" || !("value" in attr.value))
1426
- return ["copy"];
1427
- try {
1428
- const parsed = JSON.parse(attr.value.value);
1429
- if (Array.isArray(parsed)) {
1430
- return parsed.filter((a) => typeof a === "string");
1431
- }
1432
- } catch (_a) {
1433
- }
1434
- return ["copy"];
1416
+ const value = parseMdxAttributes(node.attributes, { staticOnly: true }).actions;
1417
+ return Array.isArray(value) ? value.filter((action) => typeof action === "string") : ["copy"];
1435
1418
  }
1436
1419
  function stripAutolinks(tree) {
1437
1420
  visit(tree, "link", (node, index, parent) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1498",
3
+ "version": "4.0.1500",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
- "@mintlify/common": "1.0.1148",
49
- "@mintlify/link-rot": "3.0.1350",
48
+ "@mintlify/common": "1.0.1149",
49
+ "@mintlify/link-rot": "3.0.1351",
50
50
  "@mintlify/models": "0.0.357",
51
- "@mintlify/prebuild": "1.0.1302",
52
- "@mintlify/previewing": "4.0.1374",
53
- "@mintlify/validation": "0.1.856",
51
+ "@mintlify/prebuild": "1.0.1303",
52
+ "@mintlify/previewing": "4.0.1375",
53
+ "@mintlify/validation": "0.1.857",
54
54
  "adm-zip": "0.6.0",
55
55
  "chalk": "5.2.0",
56
56
  "color": "4.2.3",
@@ -86,7 +86,7 @@
86
86
  "keytar": "7.9.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@mintlify/editor": "0.0.382",
89
+ "@mintlify/editor": "0.0.384",
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": "65f00bdd45df91801aee073c12dd96aa57d7c8d9"
108
+ "gitHead": "a29e5e92240fa2bb5df07de313bac0b502b64811"
109
109
  }