@mintlify/cli 4.0.1460 → 4.0.1462
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/mintTest.js +1 -1
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/bin/vendor/converter.js +93 -11
- package/package.json +3 -3
- package/src/mintTest.tsx +1 -1
package/bin/vendor/converter.js
CHANGED
|
@@ -9981,21 +9981,32 @@ function getNamedExpressionAttr(attrs2, key) {
|
|
|
9981
9981
|
}
|
|
9982
9982
|
|
|
9983
9983
|
// ../editor/dist/converter/serialize/serializer-state.js
|
|
9984
|
+
var ALWAYS_ESCAPED = /* @__PURE__ */ new Set(["\\", "`", "*", "{", "}", "<", "$"]);
|
|
9985
|
+
var WORD_CHAR = /[\p{L}\p{N}]/u;
|
|
9986
|
+
var TASK_MARKER = /^\[[ xX]\]/;
|
|
9987
|
+
var LINK_CLOSE = /\][([]/;
|
|
9988
|
+
var DEFINITION_CLOSE = /\]:/;
|
|
9989
|
+
function isWordChar(ch) {
|
|
9990
|
+
return ch !== void 0 && WORD_CHAR.test(ch);
|
|
9991
|
+
}
|
|
9984
9992
|
var SerializerState = class {
|
|
9985
9993
|
constructor(options = {}) {
|
|
9986
|
-
var _a, _b, _c;
|
|
9994
|
+
var _a, _b, _c, _d;
|
|
9987
9995
|
this.out = "";
|
|
9988
9996
|
this.delim = "";
|
|
9989
9997
|
this.closed = false;
|
|
9990
9998
|
this.inTable = false;
|
|
9991
9999
|
this.inCodeSection = false;
|
|
10000
|
+
this.hasReferenceDefinitions = false;
|
|
9992
10001
|
this.indentSize = 2;
|
|
9993
10002
|
this.options = {
|
|
9994
10003
|
tightLists: (_a = options.tightLists) !== null && _a !== void 0 ? _a : false,
|
|
9995
10004
|
indentSize: (_b = options.indentSize) !== null && _b !== void 0 ? _b : 2,
|
|
9996
|
-
removeTrailingNewline: (_c = options.removeTrailingNewline) !== null && _c !== void 0 ? _c : true
|
|
10005
|
+
removeTrailingNewline: (_c = options.removeTrailingNewline) !== null && _c !== void 0 ? _c : true,
|
|
10006
|
+
hasReferenceDefinitions: (_d = options.hasReferenceDefinitions) !== null && _d !== void 0 ? _d : false
|
|
9997
10007
|
};
|
|
9998
10008
|
this.indentSize = this.options.indentSize;
|
|
10009
|
+
this.hasReferenceDefinitions = this.options.hasReferenceDefinitions;
|
|
9999
10010
|
}
|
|
10000
10011
|
/**
|
|
10001
10012
|
* Writes content to the output, handling closed blocks and current delimiters.
|
|
@@ -10041,9 +10052,38 @@ var SerializerState = class {
|
|
|
10041
10052
|
return this.inTable ? str2.replace(/\|/g, "\\|") : str2;
|
|
10042
10053
|
}
|
|
10043
10054
|
/** Escapes special Markdown characters in the input string. */
|
|
10044
|
-
esc(str2) {
|
|
10045
|
-
|
|
10046
|
-
|
|
10055
|
+
esc(str2, options = {}) {
|
|
10056
|
+
let out = "";
|
|
10057
|
+
for (let i = 0; i < str2.length; i++) {
|
|
10058
|
+
const ch = str2[i];
|
|
10059
|
+
if (this.needsEscape(str2, i, options))
|
|
10060
|
+
out += "\\";
|
|
10061
|
+
out += ch;
|
|
10062
|
+
}
|
|
10063
|
+
return out;
|
|
10064
|
+
}
|
|
10065
|
+
needsEscape(str2, i, { inLinkText = false }) {
|
|
10066
|
+
const ch = str2[i];
|
|
10067
|
+
const prev = str2[i - 1];
|
|
10068
|
+
const next = str2[i + 1];
|
|
10069
|
+
if (ALWAYS_ESCAPED.has(ch))
|
|
10070
|
+
return true;
|
|
10071
|
+
switch (ch) {
|
|
10072
|
+
case "|":
|
|
10073
|
+
return this.inTable;
|
|
10074
|
+
case "_":
|
|
10075
|
+
return !(isWordChar(prev) && isWordChar(next));
|
|
10076
|
+
case "[":
|
|
10077
|
+
return inLinkText || this.hasReferenceDefinitions || next === "^" || i === 0 && (TASK_MARKER.test(str2) || DEFINITION_CLOSE.test(str2)) || LINK_CLOSE.test(str2.slice(i + 1));
|
|
10078
|
+
case "]":
|
|
10079
|
+
return inLinkText || this.hasReferenceDefinitions || next === "(" || next === "[" || next === ":" && str2[0] === "[";
|
|
10080
|
+
case ">":
|
|
10081
|
+
return i === 0;
|
|
10082
|
+
case "+":
|
|
10083
|
+
return i === 0 && (next === void 0 || next === " " || next === " ");
|
|
10084
|
+
default:
|
|
10085
|
+
return false;
|
|
10086
|
+
}
|
|
10047
10087
|
}
|
|
10048
10088
|
};
|
|
10049
10089
|
|
|
@@ -10118,7 +10158,7 @@ function writeImgTag(state, attrs2) {
|
|
|
10118
10158
|
state.write("/>");
|
|
10119
10159
|
}
|
|
10120
10160
|
function writeMarkdownImage(state, imgAttributes, src) {
|
|
10121
|
-
const alt = state.esc(String(imgAttributes["alt"] || ""));
|
|
10161
|
+
const alt = state.esc(String(imgAttributes["alt"] || ""), { inLinkText: true });
|
|
10122
10162
|
const escapedSrc = src.replace(/[()]/g, "\\$&");
|
|
10123
10163
|
const title = imgAttributes["title"];
|
|
10124
10164
|
if (typeof title === "string" && title) {
|
|
@@ -10685,9 +10725,20 @@ function renderMdxEsm(state, node) {
|
|
|
10685
10725
|
}
|
|
10686
10726
|
state.closeBlock();
|
|
10687
10727
|
}
|
|
10728
|
+
var WORD_CHAR2 = /[\p{L}\p{N}]/u;
|
|
10729
|
+
function unescapeIntrawordUnderscores(text) {
|
|
10730
|
+
return text.replace(/\\_/g, (match, offset) => {
|
|
10731
|
+
const prev = text[offset - 1];
|
|
10732
|
+
const next = text[offset + 2];
|
|
10733
|
+
return prev !== void 0 && WORD_CHAR2.test(prev) && next !== void 0 && WORD_CHAR2.test(next) ? "_" : match;
|
|
10734
|
+
});
|
|
10735
|
+
}
|
|
10736
|
+
var stringifyHandlers = {
|
|
10737
|
+
text: (node, _parent, state, info) => unescapeIntrawordUnderscores(state.safe(node.value, info))
|
|
10738
|
+
};
|
|
10688
10739
|
function stringifyMdxNode(children) {
|
|
10689
10740
|
const wrapped = children.map((child) => (child === null || child === void 0 ? void 0 : child.type) === "mdxJsxTextElement" ? { type: "paragraph", children: [child] } : child);
|
|
10690
|
-
const result = unified().use(remarkMdx2).use(remarkGfm2).use(remarkStringify).stringify({ type: "root", children: wrapped });
|
|
10741
|
+
const result = unified().use(remarkMdx2).use(remarkGfm2).use(remarkStringify, { handlers: stringifyHandlers }).stringify({ type: "root", children: wrapped });
|
|
10691
10742
|
return typeof result === "string" ? result : String(result);
|
|
10692
10743
|
}
|
|
10693
10744
|
function renderMermaidBlock(state, node) {
|
|
@@ -10931,11 +10982,17 @@ function renderInline(state, node, renderNode2, inlineRenderers2) {
|
|
|
10931
10982
|
}
|
|
10932
10983
|
if (closingIndices.size === 0 && opening.length === 0)
|
|
10933
10984
|
return;
|
|
10934
|
-
|
|
10985
|
+
const codeIndex = active.findIndex((m) => m.type.name === "code");
|
|
10986
|
+
const interruptCode = opening.length > 0 && codeIndex !== -1 && !closingIndices.has(codeIndex);
|
|
10987
|
+
let deferredCode;
|
|
10988
|
+
if (closingIndices.size > 0 || interruptCode) {
|
|
10935
10989
|
let earliestClose = active.length;
|
|
10936
10990
|
for (const idx of closingIndices) {
|
|
10937
10991
|
earliestClose = Math.min(earliestClose, idx);
|
|
10938
10992
|
}
|
|
10993
|
+
if (interruptCode) {
|
|
10994
|
+
earliestClose = Math.min(earliestClose, codeIndex);
|
|
10995
|
+
}
|
|
10939
10996
|
let trailingSpace = "";
|
|
10940
10997
|
const closingFlanking = [...closingIndices].some((idx) => {
|
|
10941
10998
|
const m = active[idx];
|
|
@@ -10967,14 +11024,26 @@ function renderInline(state, node, renderNode2, inlineRenderers2) {
|
|
|
10967
11024
|
state.write(trailingSpace);
|
|
10968
11025
|
}
|
|
10969
11026
|
for (const mark of continuing) {
|
|
11027
|
+
if (mark.type.name === "code") {
|
|
11028
|
+
deferredCode = mark;
|
|
11029
|
+
continue;
|
|
11030
|
+
}
|
|
10970
11031
|
state.write(getMarkStrings(mark).open);
|
|
10971
11032
|
active.push(mark);
|
|
10972
11033
|
}
|
|
10973
11034
|
}
|
|
10974
11035
|
for (const mark of opening) {
|
|
11036
|
+
if (mark.type.name === "code") {
|
|
11037
|
+
deferredCode = mark;
|
|
11038
|
+
continue;
|
|
11039
|
+
}
|
|
10975
11040
|
state.write(getMarkStrings(mark).open);
|
|
10976
11041
|
active.push(mark);
|
|
10977
11042
|
}
|
|
11043
|
+
if (deferredCode) {
|
|
11044
|
+
state.write(getMarkStrings(deferredCode).open);
|
|
11045
|
+
active.push(deferredCode);
|
|
11046
|
+
}
|
|
10978
11047
|
};
|
|
10979
11048
|
for (let i = 0; i < node.childCount; i++) {
|
|
10980
11049
|
const child = node.child(i);
|
|
@@ -10998,7 +11067,7 @@ function renderInline(state, node, renderNode2, inlineRenderers2) {
|
|
|
10998
11067
|
if (active.some((m) => m.type.name === "code")) {
|
|
10999
11068
|
state.write(state.escCodeText(text));
|
|
11000
11069
|
} else {
|
|
11001
|
-
state.write(state.esc(text));
|
|
11070
|
+
state.write(state.esc(text, { inLinkText: active.some((m) => m.type.name === "link") }));
|
|
11002
11071
|
}
|
|
11003
11072
|
} else {
|
|
11004
11073
|
if (typeName === BLOCK_TYPES.inlineImage) {
|
|
@@ -11066,7 +11135,7 @@ function renderTextNode(state, node) {
|
|
|
11066
11135
|
if (leadingSpace)
|
|
11067
11136
|
state.write(leadingSpace);
|
|
11068
11137
|
state.write(openMarks);
|
|
11069
|
-
state.write(marks2.some((m) => m.type.name === "code") ? state.escCodeText(innerText) : state.esc(innerText));
|
|
11138
|
+
state.write(marks2.some((m) => m.type.name === "code") ? state.escCodeText(innerText) : state.esc(innerText, { inLinkText: marks2.some((m) => m.type.name === "link") }));
|
|
11070
11139
|
state.write(closeMarks);
|
|
11071
11140
|
if (trailingSpace)
|
|
11072
11141
|
state.write(trailingSpace);
|
|
@@ -11159,9 +11228,22 @@ var BLOCK_LINE_TYPES = /* @__PURE__ */ new Set([
|
|
|
11159
11228
|
BLOCK_TYPES.tree,
|
|
11160
11229
|
BLOCK_TYPES.visibility
|
|
11161
11230
|
]);
|
|
11231
|
+
var REFERENCE_DEFINITION_TYPES = /* @__PURE__ */ new Set(["definition", "footnoteDefinition"]);
|
|
11232
|
+
function hasReferenceDefinitions(doc) {
|
|
11233
|
+
let found = false;
|
|
11234
|
+
doc.descendants((node) => {
|
|
11235
|
+
if (found)
|
|
11236
|
+
return false;
|
|
11237
|
+
const mdxJsxNode = node.attrs.mdxJsxNode;
|
|
11238
|
+
if ((mdxJsxNode === null || mdxJsxNode === void 0 ? void 0 : mdxJsxNode.type) && REFERENCE_DEFINITION_TYPES.has(mdxJsxNode.type))
|
|
11239
|
+
found = true;
|
|
11240
|
+
return !found;
|
|
11241
|
+
});
|
|
11242
|
+
return found;
|
|
11243
|
+
}
|
|
11162
11244
|
function pmToMdx(doc, options = {}) {
|
|
11163
11245
|
const { frontmatter } = options, serializerOptions = __rest2(options, ["frontmatter"]);
|
|
11164
|
-
const state = new SerializerState(serializerOptions);
|
|
11246
|
+
const state = new SerializerState(Object.assign(Object.assign({}, serializerOptions), { hasReferenceDefinitions: hasReferenceDefinitions(doc) }));
|
|
11165
11247
|
if (frontmatter && Object.keys(frontmatter).length > 0) {
|
|
11166
11248
|
const entries = Object.entries(filterFrontmatterRecord(frontmatter));
|
|
11167
11249
|
if (entries.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1462",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.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.350",
|
|
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": "799643f245ba6bc0097b6baca6314a4d9094effd"
|
|
109
109
|
}
|
package/src/mintTest.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export async function mintTestHandler(): Promise<void> {
|
|
|
25
25
|
}
|
|
26
26
|
const cliStatus = await getCliStatus(accessToken);
|
|
27
27
|
const orgName = cliStatus?.org.name.toLowerCase();
|
|
28
|
-
if (orgName !== 'mintlify' && orgName !== 'mintlify
|
|
28
|
+
if (orgName !== 'mintlify' && orgName !== 'mintlify internal') {
|
|
29
29
|
process.stderr.write('mint test is not available for your organization.\n');
|
|
30
30
|
await terminate(1);
|
|
31
31
|
return;
|