@mintlify/cli 4.0.1581 → 4.0.1583
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
|
@@ -158,8 +158,12 @@ var HIDDEN_NODE_ATTRS = /* @__PURE__ */ new Set([
|
|
|
158
158
|
"__expressionAttributes",
|
|
159
159
|
"__namedExpressionAttributes",
|
|
160
160
|
"__editorOpen",
|
|
161
|
-
"__mintlifyExtraAttrs"
|
|
161
|
+
"__mintlifyExtraAttrs",
|
|
162
|
+
"__jsxImage",
|
|
163
|
+
"__closingTag"
|
|
162
164
|
]);
|
|
165
|
+
var JSX_IMAGE_KEY = "__jsxImage";
|
|
166
|
+
var CLOSING_TAG_KEY = "__closingTag";
|
|
163
167
|
var IMAGE_ALIGN_CLASSES = {
|
|
164
168
|
left: "mr-auto",
|
|
165
169
|
center: "mx-auto",
|
|
@@ -884,7 +888,7 @@ function normalizeBlockContent(nodes2, schema) {
|
|
|
884
888
|
|
|
885
889
|
// ../editor/dist/converter/parse/mdast-to-pm.js
|
|
886
890
|
import { Node } from "prosemirror-model";
|
|
887
|
-
import { visit as
|
|
891
|
+
import { visit as visit3 } from "unist-util-visit";
|
|
888
892
|
|
|
889
893
|
// ../editor/dist/converter/parse/mdx-to-mdast.js
|
|
890
894
|
import { preprocessCustomHeadingIds } from "@mintlify/common";
|
|
@@ -893,6 +897,7 @@ import remarkFrontmatter from "remark-frontmatter";
|
|
|
893
897
|
import remarkGfm from "remark-gfm";
|
|
894
898
|
import remarkMath from "remark-math";
|
|
895
899
|
import remarkMdx from "remark-mdx";
|
|
900
|
+
import { visit } from "unist-util-visit";
|
|
896
901
|
var coreRemark = remark().use(remarkMdx).use(remarkGfm).use(remarkFrontmatter, ["yaml", "toml"]).freeze();
|
|
897
902
|
var mathRemark = coreRemark().use(remarkMath).freeze();
|
|
898
903
|
function convertHtmlCommentsToJsx(mdx) {
|
|
@@ -907,8 +912,26 @@ function preprocessMdxSource(mdx, options = {}) {
|
|
|
907
912
|
preprocessed: preprocessCustomHeadingIds(sanitized, { preserveOriginal: true })
|
|
908
913
|
};
|
|
909
914
|
}
|
|
915
|
+
var CLOSING_VIDEO_TAG = /<\/\s*video\s*>$/;
|
|
916
|
+
var isVideoElement = (node) => (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === "video";
|
|
917
|
+
function markClosedVideos(root, text) {
|
|
918
|
+
visit(root, (node) => {
|
|
919
|
+
var _a, _b;
|
|
920
|
+
if (!isVideoElement(node))
|
|
921
|
+
return;
|
|
922
|
+
const start = (_a = node.position) === null || _a === void 0 ? void 0 : _a.start.offset;
|
|
923
|
+
const end = (_b = node.position) === null || _b === void 0 ? void 0 : _b.end.offset;
|
|
924
|
+
if (start === void 0 || end === void 0)
|
|
925
|
+
return;
|
|
926
|
+
if (CLOSING_VIDEO_TAG.test(text.slice(start, end))) {
|
|
927
|
+
node.data = Object.assign(Object.assign({}, node.data), { closingTag: true });
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
}
|
|
910
931
|
function parsePreprocessedMdx(preprocessed, math = true) {
|
|
911
|
-
|
|
932
|
+
const root = (math ? mathRemark : coreRemark)().parse(preprocessed);
|
|
933
|
+
markClosedVideos(root, preprocessed);
|
|
934
|
+
return root;
|
|
912
935
|
}
|
|
913
936
|
function mdxToMdast(mdx, options = {
|
|
914
937
|
omitHtmlComments: true
|
|
@@ -1053,7 +1076,7 @@ function sanitizeDomAttrs(attrs2) {
|
|
|
1053
1076
|
if (key === EXPRESSION_ATTRS_KEY || key === NAMED_EXPRESSION_ATTRS_KEY || key === EXTRA_ATTRS_KEY) {
|
|
1054
1077
|
continue;
|
|
1055
1078
|
}
|
|
1056
|
-
if (REACT_RESERVED_ATTRS.has(key))
|
|
1079
|
+
if (REACT_RESERVED_ATTRS.has(key) || HIDDEN_NODE_ATTRS.has(key))
|
|
1057
1080
|
continue;
|
|
1058
1081
|
if (key in rawExpressions && value === rawExpressions[key])
|
|
1059
1082
|
continue;
|
|
@@ -1141,15 +1164,17 @@ function parseImgNode(node, spreadAttrs = false) {
|
|
|
1141
1164
|
if (isAttributeRecord(style)) {
|
|
1142
1165
|
width = getImageWidthFromStyle(style);
|
|
1143
1166
|
}
|
|
1167
|
+
const imgAttributes = Object.assign(Object.assign({}, spreadAttrs ? Object.assign({}, attributes) : attributes), { [JSX_IMAGE_KEY]: true });
|
|
1144
1168
|
return {
|
|
1145
1169
|
type: BLOCK_TYPES.image,
|
|
1146
|
-
attrs: { imgAttributes
|
|
1170
|
+
attrs: { imgAttributes, align, width }
|
|
1147
1171
|
};
|
|
1148
1172
|
}
|
|
1149
1173
|
function isVideoSourceElement(child) {
|
|
1150
1174
|
return (child.type === "mdxJsxTextElement" || child.type === "mdxJsxFlowElement") && child.name === "source";
|
|
1151
1175
|
}
|
|
1152
1176
|
function parseVideoNode(node) {
|
|
1177
|
+
var _a;
|
|
1153
1178
|
const editable = node.children.every((child) => isVideoSourceElement(child) || child.type === "text" && child.value.trim() === "");
|
|
1154
1179
|
if (!editable) {
|
|
1155
1180
|
return {
|
|
@@ -1158,10 +1183,11 @@ function parseVideoNode(node) {
|
|
|
1158
1183
|
};
|
|
1159
1184
|
}
|
|
1160
1185
|
const sources = node.children.filter(isVideoSourceElement).map((child) => parseMdxAttributes(child.attributes));
|
|
1186
|
+
const videoAttributes = parseMdxAttributes(node.attributes);
|
|
1161
1187
|
return {
|
|
1162
1188
|
type: BLOCK_TYPES.video,
|
|
1163
1189
|
attrs: {
|
|
1164
|
-
videoAttributes:
|
|
1190
|
+
videoAttributes: ((_a = node.data) === null || _a === void 0 ? void 0 : _a.closingTag) === true ? Object.assign(Object.assign({}, videoAttributes), { [CLOSING_TAG_KEY]: true }) : videoAttributes,
|
|
1165
1191
|
sources: sources.length > 0 ? sources : null
|
|
1166
1192
|
}
|
|
1167
1193
|
};
|
|
@@ -1295,14 +1321,14 @@ function convertToInlineImage(node) {
|
|
|
1295
1321
|
}
|
|
1296
1322
|
return {
|
|
1297
1323
|
type: BLOCK_TYPES.inlineImage,
|
|
1298
|
-
attrs: { imgAttributes: Object.assign({}, attributes), width }
|
|
1324
|
+
attrs: { imgAttributes: Object.assign(Object.assign({}, attributes), { [JSX_IMAGE_KEY]: true }), width }
|
|
1299
1325
|
};
|
|
1300
1326
|
}
|
|
1301
1327
|
return null;
|
|
1302
1328
|
}
|
|
1303
1329
|
|
|
1304
1330
|
// ../editor/dist/converter/parse/handlers/prompt.js
|
|
1305
|
-
import { SKIP, visit } from "unist-util-visit";
|
|
1331
|
+
import { SKIP, visit as visit2 } from "unist-util-visit";
|
|
1306
1332
|
function handlePrompt(node, ctx, transformNode2) {
|
|
1307
1333
|
var _a;
|
|
1308
1334
|
const icon = readPromptAttr(node, "icon");
|
|
@@ -1370,7 +1396,7 @@ function readPromptActions(node) {
|
|
|
1370
1396
|
return Array.isArray(value) ? value.filter((action) => typeof action === "string") : ["copy"];
|
|
1371
1397
|
}
|
|
1372
1398
|
function stripAutolinks(tree) {
|
|
1373
|
-
|
|
1399
|
+
visit2(tree, "link", (node, index, parent) => {
|
|
1374
1400
|
var _a;
|
|
1375
1401
|
if (parent && typeof index === "number" && node.children.length === 1 && ((_a = node.children[0]) === null || _a === void 0 ? void 0 : _a.type) === "text" && node.children[0].value === node.url) {
|
|
1376
1402
|
parent.children[index] = { type: "text", value: node.url };
|
|
@@ -2512,7 +2538,7 @@ function mdastToPm(mdast, source = "", options) {
|
|
|
2512
2538
|
const schema = (_a = options === null || options === void 0 ? void 0 : options.schema) !== null && _a !== void 0 ? _a : mintlifySchema;
|
|
2513
2539
|
const frontmatter = extractFrontmatter(mdast);
|
|
2514
2540
|
const definitions = /* @__PURE__ */ new Map();
|
|
2515
|
-
|
|
2541
|
+
visit3(mdast, (node) => {
|
|
2516
2542
|
if (node.type === "definition" && !definitions.has(node.identifier)) {
|
|
2517
2543
|
definitions.set(node.identifier, node);
|
|
2518
2544
|
}
|
|
@@ -3582,7 +3608,7 @@ function classifyImage(node) {
|
|
|
3582
3608
|
const src = lightSrc || imgAttributes["src"];
|
|
3583
3609
|
if (!src)
|
|
3584
3610
|
return { kind: "none" };
|
|
3585
|
-
if (typeof src !== "string")
|
|
3611
|
+
if (typeof src !== "string" || imgAttributes[JSX_IMAGE_KEY] === true)
|
|
3586
3612
|
return { kind: "jsx" };
|
|
3587
3613
|
const hasExtraAttrs = Object.keys(imgAttributes).some((attr) => attr !== "src" && attr !== "alt" && attr !== "title");
|
|
3588
3614
|
if (hasExtraAttrs || width || align || !fitsMarkdownImageValues(Object.assign(Object.assign({}, imgAttributes), { src }))) {
|
|
@@ -3716,7 +3742,9 @@ function renderVideo(state, node) {
|
|
|
3716
3742
|
const sources = (_b = node.attrs.sources) !== null && _b !== void 0 ? _b : [];
|
|
3717
3743
|
state.write("<video");
|
|
3718
3744
|
writeJsxAttributesInline(state, videoAttributes);
|
|
3719
|
-
if (sources.length === 0) {
|
|
3745
|
+
if (sources.length === 0 && videoAttributes[CLOSING_TAG_KEY] === true) {
|
|
3746
|
+
state.write("></video>");
|
|
3747
|
+
} else if (sources.length === 0) {
|
|
3720
3748
|
state.write(" />");
|
|
3721
3749
|
} else {
|
|
3722
3750
|
state.write(">");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1583",
|
|
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.1205",
|
|
49
|
+
"@mintlify/link-rot": "3.0.1413",
|
|
50
50
|
"@mintlify/models": "0.0.365",
|
|
51
|
-
"@mintlify/prebuild": "1.0.
|
|
52
|
-
"@mintlify/previewing": "4.0.
|
|
51
|
+
"@mintlify/prebuild": "1.0.1364",
|
|
52
|
+
"@mintlify/previewing": "4.0.1436",
|
|
53
53
|
"@mintlify/validation": "0.1.890",
|
|
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.459",
|
|
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": "a923b1de14eb511a812df976f3e76c93fbf056b5"
|
|
109
109
|
}
|