@mintlify/cli 4.0.1377 → 4.0.1379

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.
@@ -147,6 +147,7 @@ var EDITOR_COMPONENT_NAMES = /* @__PURE__ */ new Set([
147
147
  "Prompt",
148
148
  "Mermaid"
149
149
  ]);
150
+ var INLINE_COMPONENTS = /* @__PURE__ */ new Set(["Badge", "Icon", "Tooltip"]);
150
151
  var IGNORED_MERGE_ATTRS = /* @__PURE__ */ new Set([
151
152
  "__childIndex",
152
153
  "__isLastInGroup",
@@ -1371,8 +1372,25 @@ function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
1371
1372
  attrs: { mdxJsxNode: node }
1372
1373
  };
1373
1374
  }
1375
+ function flattenJsxParagraphs(node) {
1376
+ const children = node.children.flatMap((child) => {
1377
+ if (child.type !== "paragraph" || !isJsxOnly(child.children))
1378
+ return child;
1379
+ return child.children.filter((jsx) => jsx.type === "mdxJsxTextElement").map((jsx) => Object.assign(Object.assign({}, jsx), { type: "mdxJsxFlowElement" }));
1380
+ });
1381
+ return Object.assign(Object.assign({}, node), { children });
1382
+ }
1383
+ function componentChildren(node, name) {
1384
+ return flattenJsxParagraphs(node).children.filter((child) => child.type === "mdxJsxFlowElement" && (name === void 0 || child.name === name));
1385
+ }
1386
+ function isJsxOnly(children) {
1387
+ return children.every((child) => child.type === "mdxJsxTextElement" && isBlockName(child.name) || child.type === "text" && child.value.trim() === "");
1388
+ }
1389
+ function isBlockName(name) {
1390
+ return !!name && !HTML_ELEMENTS.has(name) && !INLINE_COMPONENTS.has(name);
1391
+ }
1374
1392
  function handleSteps(node, ctx, mapJsxChildren2) {
1375
- const stepChildren = node.children.filter((child) => child.type === "mdxJsxFlowElement" && child.name === BLOCK_TYPES.step);
1393
+ const stepChildren = componentChildren(node, BLOCK_TYPES.step);
1376
1394
  const pmStepChildren = stepChildren.map((stepChild, index) => {
1377
1395
  const stepAttrs = parseMdxAttributes(stepChild.attributes);
1378
1396
  const titleText = stepAttrs.title;
@@ -1445,7 +1463,7 @@ function handleToggleContent(node, ctx, transformNode2, mapJsxChildren2) {
1445
1463
  })
1446
1464
  };
1447
1465
  }
1448
- const flowChildren = node.children.filter((child) => child.type === "mdxJsxFlowElement");
1466
+ const flowChildren = componentChildren(node);
1449
1467
  if (flowChildren.length > 0) {
1450
1468
  const childType = (_c = toggleContent[(_b = node.name) !== null && _b !== void 0 ? _b : ""]) !== null && _c !== void 0 ? _c : BLOCK_TYPES.tab;
1451
1469
  const partitionChild = (parsed) => childType === BLOCK_TYPES.tab ? partitionAttrs(parsed, TAB_ATTRS) : parsed;
@@ -1469,7 +1487,7 @@ function handleToggleContent(node, ctx, transformNode2, mapJsxChildren2) {
1469
1487
  }
1470
1488
  function handleColumns(node, ctx, mapJsxChildren2) {
1471
1489
  const attrs2 = partitionAttrs(parseMdxAttributes(node.attributes), COLUMNS_ATTRS);
1472
- const columnChildren = node.children.filter((child) => child.type === "mdxJsxFlowElement" && child.name === BLOCK_TYPES.column);
1490
+ const columnChildren = componentChildren(node, BLOCK_TYPES.column);
1473
1491
  if (columnChildren.length > 0) {
1474
1492
  const pmChildren = columnChildren.map((child) => {
1475
1493
  const content = mapJsxChildren2(child, Object.assign(Object.assign({}, ctx), { hasGroupParent: true }));
@@ -1504,14 +1522,13 @@ function handleColor(node) {
1504
1522
  const colorAttrs = parseMdxAttributes(node.attributes);
1505
1523
  const variant = typeof colorAttrs.variant === "string" ? colorAttrs.variant : null;
1506
1524
  const extraColorAttrs = partitionAttrs(colorAttrs, [], ["variant"]);
1507
- const flowChildren = node.children.filter((child) => child.type === "mdxJsxFlowElement");
1508
- const colorData = flowChildren.map((child) => {
1525
+ const colorData = componentChildren(node).map((child) => {
1509
1526
  if (child.name === "Color.Item") {
1510
1527
  return parseColorItemNode(child);
1511
1528
  }
1512
1529
  if (child.name === "Color.Row") {
1513
1530
  const rowAttrs = parseMdxAttributes(child.attributes);
1514
- const rowItems = child.children.filter((c) => c.type === "mdxJsxFlowElement" && c.name === "Color.Item").map(parseColorItemNode);
1531
+ const rowItems = componentChildren(child, "Color.Item").map(parseColorItemNode);
1515
1532
  return {
1516
1533
  type: "row",
1517
1534
  title: typeof rowAttrs.title === "string" ? rowAttrs.title : void 0,
@@ -1526,7 +1543,7 @@ function handleColor(node) {
1526
1543
  };
1527
1544
  }
1528
1545
  function parseTreeChildren(node) {
1529
- return node.children.filter((child) => child.type === "mdxJsxFlowElement").map((child) => {
1546
+ return componentChildren(node).map((child) => {
1530
1547
  if (child.name === "Tree.File") {
1531
1548
  const fileAttrs = parseMdxAttributes(child.attributes);
1532
1549
  return {
@@ -2393,7 +2410,7 @@ function isInlineNode(node, schema) {
2393
2410
  }
2394
2411
  function mapJsxChildren(node, ctx) {
2395
2412
  var _a;
2396
- const nodes2 = node.children.flatMap((child) => {
2413
+ const nodes2 = flattenJsxParagraphs({ children: node.children }).children.flatMap((child) => {
2397
2414
  if (child.type === "mdxJsxFlowElement") {
2398
2415
  return handleFlowJsx(child, ctx, transformNode, mapJsxChildren);
2399
2416
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1377",
3
+ "version": "4.0.1379",
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.1070",
49
- "@mintlify/link-rot": "3.0.1267",
48
+ "@mintlify/common": "1.0.1071",
49
+ "@mintlify/link-rot": "3.0.1268",
50
50
  "@mintlify/models": "0.0.344",
51
- "@mintlify/prebuild": "1.0.1221",
52
- "@mintlify/previewing": "4.0.1291",
51
+ "@mintlify/prebuild": "1.0.1222",
52
+ "@mintlify/previewing": "4.0.1292",
53
53
  "@mintlify/validation": "0.1.816",
54
54
  "adm-zip": "0.5.16",
55
55
  "chalk": "5.2.0",
@@ -81,7 +81,7 @@
81
81
  "keytar": "7.9.0"
82
82
  },
83
83
  "devDependencies": {
84
- "@mintlify/editor": "0.0.279",
84
+ "@mintlify/editor": "0.0.281",
85
85
  "@mintlify/ts-config": "2.0.2",
86
86
  "@tsconfig/recommended": "1.0.2",
87
87
  "@types/adm-zip": "0.5.7",
@@ -101,5 +101,5 @@
101
101
  "vitest": "2.1.9",
102
102
  "vitest-mock-process": "1.0.4"
103
103
  },
104
- "gitHead": "7a9c2381977df9370dcd067d396605e0f923bec7"
104
+ "gitHead": "24e02114e244af78c8f5b90759cdfc93052cab28"
105
105
  }