@mintlify/cli 4.0.1464 → 4.0.1466
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.
package/bin/vendor/converter.js
CHANGED
|
@@ -829,7 +829,13 @@ var marks = {
|
|
|
829
829
|
strike: {},
|
|
830
830
|
code: {},
|
|
831
831
|
link: {
|
|
832
|
-
attrs: attrs({
|
|
832
|
+
attrs: attrs({
|
|
833
|
+
href: null,
|
|
834
|
+
title: null,
|
|
835
|
+
referenceLabel: null,
|
|
836
|
+
mdxLinkAttributes: null,
|
|
837
|
+
mdxLinkId: null
|
|
838
|
+
})
|
|
833
839
|
},
|
|
834
840
|
underline: {},
|
|
835
841
|
subscript: {},
|
|
@@ -847,9 +853,6 @@ function createSchema(extra) {
|
|
|
847
853
|
import { Node } from "prosemirror-model";
|
|
848
854
|
import { visit as visit2 } from "unist-util-visit";
|
|
849
855
|
|
|
850
|
-
// ../editor/dist/converter/parse/handlers/flow-jsx.js
|
|
851
|
-
import { parseTitleMarkdown } from "@mintlify/common/title-markdown";
|
|
852
|
-
|
|
853
856
|
// ../editor/dist/converter/utils/mdx-attributes.js
|
|
854
857
|
var EXPRESSION_ATTRS_KEY = "__expressionAttributes";
|
|
855
858
|
var NAMED_EXPRESSION_ATTRS_KEY = "__namedExpressionAttributes";
|
|
@@ -997,6 +1000,9 @@ function partitionAttrs(parsed, known, consumed = []) {
|
|
|
997
1000
|
return result;
|
|
998
1001
|
}
|
|
999
1002
|
|
|
1003
|
+
// ../editor/dist/converter/parse/handlers/flow-jsx.js
|
|
1004
|
+
import { parseTitleMarkdown } from "@mintlify/common/title-markdown";
|
|
1005
|
+
|
|
1000
1006
|
// ../editor/dist/converter/parse/parse-utils.js
|
|
1001
1007
|
import { parse as parseYaml } from "yaml";
|
|
1002
1008
|
function extractFrontmatter(mdast) {
|
|
@@ -2410,7 +2416,7 @@ function buildMarkdownTableCellContent(children, ctx, transformNode2) {
|
|
|
2410
2416
|
flushInlineChildren();
|
|
2411
2417
|
return cellContent;
|
|
2412
2418
|
}
|
|
2413
|
-
const isInlineOnly = children.every((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "inlineCode" || child.type === "delete" || child.type === "image" || child.type === "break" || child.type === "inlineMath" || child.type === "footnoteReference" || child.type === "mdxTextExpression" || child.type === "mdxJsxTextElement");
|
|
2419
|
+
const isInlineOnly = children.every((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "linkReference" || child.type === "inlineCode" || child.type === "delete" || child.type === "image" || child.type === "break" || child.type === "inlineMath" || child.type === "footnoteReference" || child.type === "mdxTextExpression" || child.type === "mdxJsxTextElement");
|
|
2414
2420
|
if (isInlineOnly) {
|
|
2415
2421
|
const paragraph = buildParagraphFromTableInlineChildren(children, ctx, transformNode2);
|
|
2416
2422
|
return paragraph ? [paragraph] : [];
|
|
@@ -2422,7 +2428,7 @@ function handleParagraph(node, ctx, transformNode2, mapChildren2) {
|
|
|
2422
2428
|
const schema2 = (_a = ctx.schema) !== null && _a !== void 0 ? _a : mintlifySchema;
|
|
2423
2429
|
const hasImages = node.children.some((child) => child.type === "image" || child.type === "mdxJsxTextElement" && child.name === "img");
|
|
2424
2430
|
if (hasImages) {
|
|
2425
|
-
const hasTextContent = node.children.some((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "inlineCode" || child.type === "delete" || child.type === "mdxJsxTextElement" && child.name !== "img");
|
|
2431
|
+
const hasTextContent = node.children.some((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "linkReference" || child.type === "inlineCode" || child.type === "delete" || child.type === "mdxJsxTextElement" && child.name !== "img");
|
|
2426
2432
|
if (hasTextContent) {
|
|
2427
2433
|
const content2 = [];
|
|
2428
2434
|
for (const child of node.children) {
|
|
@@ -2541,13 +2547,17 @@ function mdastToPm(mdast, source = "", options) {
|
|
|
2541
2547
|
var _a, _b;
|
|
2542
2548
|
const schema2 = (_a = options === null || options === void 0 ? void 0 : options.schema) !== null && _a !== void 0 ? _a : mintlifySchema;
|
|
2543
2549
|
const frontmatter = extractFrontmatter(mdast);
|
|
2544
|
-
const
|
|
2550
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
2545
2551
|
visit2(mdast, (node) => {
|
|
2552
|
+
if (node.type === "definition" && !definitions.has(node.identifier)) {
|
|
2553
|
+
definitions.set(node.identifier, node);
|
|
2554
|
+
}
|
|
2546
2555
|
const promptNeedsSourcePosition = node.type === "mdxJsxTextElement" && node.name === "Prompt";
|
|
2547
2556
|
if (node.type !== "list" && node.type !== "mdxJsxFlowElement" && !promptNeedsSourcePosition) {
|
|
2548
2557
|
delete node.position;
|
|
2549
2558
|
}
|
|
2550
2559
|
});
|
|
2560
|
+
const context = { source, frontmatter, schema: schema2, definitions };
|
|
2551
2561
|
const content = transformNode(mdast, context);
|
|
2552
2562
|
const rawJsonContent = Array.isArray(content) ? content : (_b = content.content) !== null && _b !== void 0 ? _b : [];
|
|
2553
2563
|
const jsonContent = normalizeBlockContent(rawJsonContent, schema2);
|
|
@@ -2636,6 +2646,16 @@ function transformNode(node, ctx) {
|
|
|
2636
2646
|
case "link":
|
|
2637
2647
|
case "delete":
|
|
2638
2648
|
return convertInlineContent(node.children, getMarks(node), ctx);
|
|
2649
|
+
case "linkReference": {
|
|
2650
|
+
const mark = getLinkReferenceMark(node, ctx);
|
|
2651
|
+
if (!mark) {
|
|
2652
|
+
return {
|
|
2653
|
+
type: BLOCK_TYPES.inlineUnknownTag,
|
|
2654
|
+
attrs: { mdxJsxNode: node }
|
|
2655
|
+
};
|
|
2656
|
+
}
|
|
2657
|
+
return convertInlineContent(node.children, [mark], ctx);
|
|
2658
|
+
}
|
|
2639
2659
|
case "inlineCode": {
|
|
2640
2660
|
const { text, marks: marks2 } = extractTextFromNode(node);
|
|
2641
2661
|
return createTextNode(text, marks2);
|
|
@@ -2657,6 +2677,9 @@ function transformNode(node, ctx) {
|
|
|
2657
2677
|
case "yaml":
|
|
2658
2678
|
return [];
|
|
2659
2679
|
case "mdxJsxTextElement": {
|
|
2680
|
+
const linkContent = convertLinkComponent(node, [], ctx);
|
|
2681
|
+
if (linkContent)
|
|
2682
|
+
return linkContent;
|
|
2660
2683
|
if (!node.name || !STRUCTURED_FLOW_COMPONENTS.has(node.name) || isContainerOnlyComponent(node.name, (_d = ctx.schema) !== null && _d !== void 0 ? _d : mintlifySchema)) {
|
|
2661
2684
|
return handleInlineJsx(node, ctx, mapChildren);
|
|
2662
2685
|
}
|
|
@@ -2682,6 +2705,11 @@ function transformNode(node, ctx) {
|
|
|
2682
2705
|
type: BLOCK_TYPES.inlineUnknownTag,
|
|
2683
2706
|
attrs: { mdxJsxNode: node }
|
|
2684
2707
|
};
|
|
2708
|
+
case "definition":
|
|
2709
|
+
return {
|
|
2710
|
+
type: BLOCK_TYPES.unknownTag,
|
|
2711
|
+
attrs: { mdxJsxNode: node, __isHidden: true }
|
|
2712
|
+
};
|
|
2685
2713
|
default:
|
|
2686
2714
|
return {
|
|
2687
2715
|
type: BLOCK_TYPES.unknownTag,
|
|
@@ -2700,8 +2728,24 @@ function convertInlineContent(children, parentMarks, ctx) {
|
|
|
2700
2728
|
results.push({ type: "hardBreak" });
|
|
2701
2729
|
} else if (child.type === "inlineCode") {
|
|
2702
2730
|
results.push(createTextNode(child.value || "", [...parentMarks, { type: "code" }]));
|
|
2731
|
+
} else if (child.type === "linkReference") {
|
|
2732
|
+
const mark = getLinkReferenceMark(child, ctx);
|
|
2733
|
+
if (mark) {
|
|
2734
|
+
results.push(...convertInlineContent(child.children, [...parentMarks, mark], ctx));
|
|
2735
|
+
} else {
|
|
2736
|
+
const converted = transformNode(child, ctx);
|
|
2737
|
+
results.push(...Array.isArray(converted) ? converted : [converted]);
|
|
2738
|
+
}
|
|
2703
2739
|
} else if (child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "delete") {
|
|
2704
2740
|
results.push(...convertInlineContent(child.children, [...parentMarks, ...getMarks(child)], ctx));
|
|
2741
|
+
} else if (child.type === "mdxJsxTextElement" && child.name === "Link") {
|
|
2742
|
+
const linkContent = convertLinkComponent(child, parentMarks, ctx);
|
|
2743
|
+
if (linkContent) {
|
|
2744
|
+
results.push(...linkContent);
|
|
2745
|
+
} else {
|
|
2746
|
+
const converted = transformNode(child, ctx);
|
|
2747
|
+
results.push(...Array.isArray(converted) ? converted : [converted]);
|
|
2748
|
+
}
|
|
2705
2749
|
} else if (child.type === "mdxJsxTextElement" && (child.name === "u" || child.name === "sub" || child.name === "sup")) {
|
|
2706
2750
|
results.push(...convertInlineContent(child.children, [...parentMarks, ...getMarks(child)], ctx));
|
|
2707
2751
|
} else if (child.type === "mdxJsxTextElement" && child.name === "kbd") {
|
|
@@ -2723,6 +2767,62 @@ function convertInlineContent(children, parentMarks, ctx) {
|
|
|
2723
2767
|
}
|
|
2724
2768
|
return results;
|
|
2725
2769
|
}
|
|
2770
|
+
function getLinkReferenceMark(node, ctx) {
|
|
2771
|
+
var _a, _b, _c, _d;
|
|
2772
|
+
const definition = (_a = ctx.definitions) === null || _a === void 0 ? void 0 : _a.get(node.identifier);
|
|
2773
|
+
if (!definition)
|
|
2774
|
+
return void 0;
|
|
2775
|
+
return {
|
|
2776
|
+
type: "link",
|
|
2777
|
+
attrs: {
|
|
2778
|
+
href: definition.url,
|
|
2779
|
+
title: (_b = definition.title) !== null && _b !== void 0 ? _b : void 0,
|
|
2780
|
+
referenceLabel: (_d = (_c = node.label) !== null && _c !== void 0 ? _c : definition.label) !== null && _d !== void 0 ? _d : node.identifier
|
|
2781
|
+
}
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2784
|
+
function convertLinkComponent(node, parentMarks, ctx) {
|
|
2785
|
+
var _a;
|
|
2786
|
+
const mark = getLinkComponentMark(node, ctx);
|
|
2787
|
+
if (!mark)
|
|
2788
|
+
return void 0;
|
|
2789
|
+
const content = convertInlineContent(node.children, [...parentMarks, mark], ctx);
|
|
2790
|
+
const schema2 = (_a = ctx.schema) !== null && _a !== void 0 ? _a : mintlifySchema;
|
|
2791
|
+
const hasSerializableContent = content.every((child) => {
|
|
2792
|
+
var _a2, _b, _c, _d;
|
|
2793
|
+
if (!isInlineNode(child, schema2))
|
|
2794
|
+
return false;
|
|
2795
|
+
if (child.type !== "text" && child.type !== BLOCK_TYPES.inlineImage && child.type !== BLOCK_TYPES.inlineUnknownTag) {
|
|
2796
|
+
return false;
|
|
2797
|
+
}
|
|
2798
|
+
const linkMarks = (_b = (_a2 = child.marks) === null || _a2 === void 0 ? void 0 : _a2.filter((childMark) => childMark.type === "link")) !== null && _b !== void 0 ? _b : [];
|
|
2799
|
+
return linkMarks.length === 1 && ((_d = (_c = linkMarks[0]) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.mdxLinkAttributes) !== void 0;
|
|
2800
|
+
});
|
|
2801
|
+
return content.length > 0 && hasSerializableContent ? content : void 0;
|
|
2802
|
+
}
|
|
2803
|
+
function getLinkComponentMark(node, ctx) {
|
|
2804
|
+
var _a;
|
|
2805
|
+
if (node.name !== "Link")
|
|
2806
|
+
return void 0;
|
|
2807
|
+
if (node.attributes.some((attribute) => attribute.type === "mdxJsxExpressionAttribute")) {
|
|
2808
|
+
return void 0;
|
|
2809
|
+
}
|
|
2810
|
+
const hrefAttribute = node.attributes.find((attribute) => attribute.type === "mdxJsxAttribute" && attribute.name === "href");
|
|
2811
|
+
if (!hrefAttribute || typeof hrefAttribute.value !== "string")
|
|
2812
|
+
return void 0;
|
|
2813
|
+
const attributes = parseMdxAttributes(node.attributes);
|
|
2814
|
+
const mdxLinkId = (_a = ctx.nextMdxLinkId) !== null && _a !== void 0 ? _a : 0;
|
|
2815
|
+
ctx.nextMdxLinkId = mdxLinkId + 1;
|
|
2816
|
+
return {
|
|
2817
|
+
type: "link",
|
|
2818
|
+
attrs: {
|
|
2819
|
+
href: hrefAttribute.value,
|
|
2820
|
+
title: typeof attributes.title === "string" ? attributes.title : void 0,
|
|
2821
|
+
mdxLinkAttributes: attributes,
|
|
2822
|
+
mdxLinkId
|
|
2823
|
+
}
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2726
2826
|
function mapChildren(node, ctx) {
|
|
2727
2827
|
const nodes2 = node.children.flatMap((child) => transformNode(child, ctx)).filter(Boolean);
|
|
2728
2828
|
return mergeDarkLightImagePairs(nodes2);
|
|
@@ -11421,6 +11521,9 @@ function renderTextNode(state, node) {
|
|
|
11421
11521
|
state.text(text);
|
|
11422
11522
|
}
|
|
11423
11523
|
}
|
|
11524
|
+
function escapeReferenceLabel(label) {
|
|
11525
|
+
return label.replace(/\\(?=[\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]|$)/g, "\\\\").replace(/[\[\]]/g, "\\$&");
|
|
11526
|
+
}
|
|
11424
11527
|
function getMarkStrings(mark) {
|
|
11425
11528
|
switch (mark.type.name) {
|
|
11426
11529
|
case "bold":
|
|
@@ -11432,6 +11535,13 @@ function getMarkStrings(mark) {
|
|
|
11432
11535
|
case "code":
|
|
11433
11536
|
return { open: "`", close: "`" };
|
|
11434
11537
|
case "link": {
|
|
11538
|
+
const componentLink = getLinkComponentMarkStrings(mark);
|
|
11539
|
+
if (componentLink)
|
|
11540
|
+
return componentLink;
|
|
11541
|
+
const referenceLabel = mark.attrs.referenceLabel;
|
|
11542
|
+
if (typeof referenceLabel === "string" && referenceLabel) {
|
|
11543
|
+
return { open: "[", close: `][${escapeReferenceLabel(referenceLabel)}]` };
|
|
11544
|
+
}
|
|
11435
11545
|
const href = mark.attrs.href || "";
|
|
11436
11546
|
const title = mark.attrs.title;
|
|
11437
11547
|
const titleStr = title ? ` "${title}"` : "";
|
|
@@ -11452,6 +11562,27 @@ function getMarkStrings(mark) {
|
|
|
11452
11562
|
return { open: "", close: "" };
|
|
11453
11563
|
}
|
|
11454
11564
|
}
|
|
11565
|
+
function getLinkComponentMarkStrings(mark) {
|
|
11566
|
+
const storedAttributes = mark.attrs.mdxLinkAttributes;
|
|
11567
|
+
const href = mark.attrs.href;
|
|
11568
|
+
if (!isAttributeRecord3(storedAttributes) || typeof href !== "string")
|
|
11569
|
+
return void 0;
|
|
11570
|
+
const attributes = Object.assign(Object.assign({}, storedAttributes), { href });
|
|
11571
|
+
if (mark.attrs.title === null || mark.attrs.title === void 0) {
|
|
11572
|
+
delete attributes.title;
|
|
11573
|
+
} else {
|
|
11574
|
+
attributes.title = mark.attrs.title;
|
|
11575
|
+
}
|
|
11576
|
+
const namedAttributes = Object.entries(attributes).filter(([key]) => key !== NAMED_EXPRESSION_ATTRS_KEY).map(([key, value]) => serializeJsxAttribute(attributes, key, value)).filter((attribute) => attribute !== null);
|
|
11577
|
+
const serializedAttributes = namedAttributes.join(" ");
|
|
11578
|
+
return {
|
|
11579
|
+
open: `<Link${serializedAttributes ? ` ${serializedAttributes}` : ""}>`,
|
|
11580
|
+
close: "</Link>"
|
|
11581
|
+
};
|
|
11582
|
+
}
|
|
11583
|
+
function isAttributeRecord3(value) {
|
|
11584
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11585
|
+
}
|
|
11455
11586
|
|
|
11456
11587
|
// ../editor/dist/converter/serialize/pm-to-mdx.js
|
|
11457
11588
|
var __rest2 = function(s, e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1466",
|
|
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.
|
|
49
|
-
"@mintlify/link-rot": "3.0.
|
|
48
|
+
"@mintlify/common": "1.0.1125",
|
|
49
|
+
"@mintlify/link-rot": "3.0.1327",
|
|
50
50
|
"@mintlify/models": "0.0.351",
|
|
51
|
-
"@mintlify/prebuild": "1.0.
|
|
52
|
-
"@mintlify/previewing": "4.0.
|
|
51
|
+
"@mintlify/prebuild": "1.0.1279",
|
|
52
|
+
"@mintlify/previewing": "4.0.1351",
|
|
53
53
|
"@mintlify/validation": "0.1.844",
|
|
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.
|
|
89
|
+
"@mintlify/editor": "0.0.354",
|
|
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": "
|
|
108
|
+
"gitHead": "ce376b725af9861a1342801490b421ba3e414136"
|
|
109
109
|
}
|