@mintlify/cli 4.0.1812 → 4.1.1

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.
Files changed (274) hide show
  1. package/dist/assets/export-scripts/README.classic.md +15 -0
  2. package/dist/assets/export-scripts/README.md +14 -0
  3. package/dist/assets/export-scripts/serve.js +114 -0
  4. package/dist/assets/export-scripts/start-docs.bat +10 -0
  5. package/dist/assets/export-scripts/start-docs.sh +9 -0
  6. package/dist/assets/og/Inter-Bold.ttf +0 -0
  7. package/dist/assets/og/Inter-Medium.ttf +0 -0
  8. package/dist/assets/og/Inter-Regular.ttf +0 -0
  9. package/dist/assets/og/Inter-SemiBold.ttf +0 -0
  10. package/dist/assets/og/PaperMono-Regular.ttf +0 -0
  11. package/dist/assets/og/index_bg.wasm +0 -0
  12. package/dist/assets/openChrome.applescript +94 -0
  13. package/dist/assets/socket.io/socket.io.esm.min.js +7 -0
  14. package/dist/assets/socket.io/socket.io.esm.min.js.map +1 -0
  15. package/dist/assets/socket.io/socket.io.js +4907 -0
  16. package/dist/assets/socket.io/socket.io.js.map +1 -0
  17. package/dist/assets/socket.io/socket.io.min.js +7 -0
  18. package/dist/assets/socket.io/socket.io.min.js.map +1 -0
  19. package/dist/assets/socket.io/socket.io.msgpack.min.js +7 -0
  20. package/dist/assets/socket.io/socket.io.msgpack.min.js.map +1 -0
  21. package/dist/assets/xdg-open +1066 -0
  22. package/dist/assets/yargs-locales/be.json +46 -0
  23. package/dist/assets/yargs-locales/cs.json +51 -0
  24. package/dist/assets/yargs-locales/de.json +46 -0
  25. package/dist/assets/yargs-locales/en.json +55 -0
  26. package/dist/assets/yargs-locales/es.json +46 -0
  27. package/dist/assets/yargs-locales/fi.json +49 -0
  28. package/dist/assets/yargs-locales/fr.json +53 -0
  29. package/dist/assets/yargs-locales/hi.json +49 -0
  30. package/dist/assets/yargs-locales/hu.json +46 -0
  31. package/dist/assets/yargs-locales/id.json +50 -0
  32. package/dist/assets/yargs-locales/it.json +46 -0
  33. package/dist/assets/yargs-locales/ja.json +51 -0
  34. package/dist/assets/yargs-locales/ko.json +49 -0
  35. package/dist/assets/yargs-locales/nb.json +44 -0
  36. package/dist/assets/yargs-locales/nl.json +49 -0
  37. package/dist/assets/yargs-locales/nn.json +44 -0
  38. package/dist/assets/yargs-locales/pirate.json +13 -0
  39. package/dist/assets/yargs-locales/pl.json +49 -0
  40. package/dist/assets/yargs-locales/pt.json +45 -0
  41. package/dist/assets/yargs-locales/pt_BR.json +48 -0
  42. package/dist/assets/yargs-locales/ru.json +51 -0
  43. package/dist/assets/yargs-locales/th.json +46 -0
  44. package/dist/assets/yargs-locales/tr.json +48 -0
  45. package/dist/assets/yargs-locales/uk_UA.json +51 -0
  46. package/dist/assets/yargs-locales/uz.json +52 -0
  47. package/dist/assets/yargs-locales/zh_CN.json +48 -0
  48. package/dist/assets/yargs-locales/zh_TW.json +51 -0
  49. package/dist/converter-d8O3xkdU.js +102 -0
  50. package/dist/devtools-CGNZQKFV.js +24 -0
  51. package/dist/index.js +8 -0
  52. package/dist/rolldown-runtime-CEAe2Uac.js +7 -0
  53. package/dist/schemas-CBsmCNpK.js +372 -0
  54. package/dist/start.js +2310 -0
  55. package/package.json +43 -36
  56. package/.oxlintrc.json +0 -5
  57. package/.prettierignore +0 -2
  58. package/.turbo/turbo-build.log +0 -1
  59. package/CONTRIBUTING.md +0 -45
  60. package/__test__/agent-auth.test.ts +0 -114
  61. package/__test__/agent-claim.test.ts +0 -164
  62. package/__test__/agent-credentials.test.ts +0 -149
  63. package/__test__/agent-deployment.test.ts +0 -106
  64. package/__test__/agent-setup-config.test.ts +0 -324
  65. package/__test__/agent-setup.test.ts +0 -207
  66. package/__test__/agent.test.ts +0 -64
  67. package/__test__/analytics/client.test.ts +0 -180
  68. package/__test__/analytics/dates.test.ts +0 -12
  69. package/__test__/analytics/filters.test.ts +0 -116
  70. package/__test__/analytics/format.test.ts +0 -137
  71. package/__test__/authenticatedFetch.test.ts +0 -182
  72. package/__test__/brokenLinks.test.ts +0 -283
  73. package/__test__/checkPort.test.ts +0 -92
  74. package/__test__/deploy-github-actions.test.ts +0 -202
  75. package/__test__/deploy-github-setup.test.ts +0 -240
  76. package/__test__/deploy-instructions.test.ts +0 -155
  77. package/__test__/deploy.test.ts +0 -202
  78. package/__test__/feedback.test.ts +0 -34
  79. package/__test__/foreignSyntax.test.ts +0 -73
  80. package/__test__/format.test.ts +0 -72
  81. package/__test__/helpers.test.ts +0 -52
  82. package/__test__/init.test.ts +0 -119
  83. package/__test__/instructions.test.ts +0 -53
  84. package/__test__/keyring.test.ts +0 -82
  85. package/__test__/mdxAccessibility.test.ts +0 -81
  86. package/__test__/migrate.test.ts +0 -186
  87. package/__test__/openApiCheck.test.ts +0 -185
  88. package/__test__/pathValidation.test.ts +0 -25
  89. package/__test__/resolveFiles.test.ts +0 -70
  90. package/__test__/sessionId.test.ts +0 -46
  91. package/__test__/signup.test.ts +0 -36
  92. package/__test__/update.test.ts +0 -117
  93. package/__test__/utils.ts +0 -25
  94. package/__test__/validateCommand.test.ts +0 -647
  95. package/__test__/validateEngine.test.ts +0 -245
  96. package/__test__/validateRules.test.ts +0 -1275
  97. package/__test__/welcome.test.ts +0 -15
  98. package/__test__/workflows/client.test.ts +0 -126
  99. package/bin/accessibility.js +0 -111
  100. package/bin/accessibilityCheck.js +0 -82
  101. package/bin/addDomain.js +0 -130
  102. package/bin/agent-auth.js +0 -104
  103. package/bin/agent-claim.js +0 -97
  104. package/bin/agent-credentials.js +0 -124
  105. package/bin/agent-deployment.js +0 -96
  106. package/bin/agent-http.js +0 -45
  107. package/bin/agent-setup-config.js +0 -141
  108. package/bin/agent-setup.js +0 -146
  109. package/bin/agent.js +0 -42
  110. package/bin/analytics/client.js +0 -60
  111. package/bin/analytics/dates.js +0 -6
  112. package/bin/analytics/filters.js +0 -27
  113. package/bin/analytics/format.js +0 -13
  114. package/bin/analytics/index.js +0 -496
  115. package/bin/analytics/output.js +0 -75
  116. package/bin/analytics/types.js +0 -1
  117. package/bin/authenticatedFetch.js +0 -46
  118. package/bin/brokenLinks.js +0 -122
  119. package/bin/callbackServer.js +0 -65
  120. package/bin/cli.js +0 -813
  121. package/bin/comingSoon.js +0 -26
  122. package/bin/config.js +0 -78
  123. package/bin/constants.js +0 -16
  124. package/bin/deploy-base.js +0 -20
  125. package/bin/deploy-github-actions.js +0 -102
  126. package/bin/deploy-github-setup.js +0 -165
  127. package/bin/deploy-instructions.js +0 -71
  128. package/bin/deploy.js +0 -123
  129. package/bin/feedback.js +0 -36
  130. package/bin/format.js +0 -121
  131. package/bin/helpers.js +0 -238
  132. package/bin/idToken.js +0 -14
  133. package/bin/index.js +0 -102
  134. package/bin/init.js +0 -182
  135. package/bin/instructions.js +0 -101
  136. package/bin/keyring.js +0 -78
  137. package/bin/login.js +0 -123
  138. package/bin/logout.js +0 -18
  139. package/bin/mdxAccessibility.js +0 -113
  140. package/bin/mdxLinter.js +0 -55
  141. package/bin/middlewares/subdomainMiddleware.js +0 -28
  142. package/bin/middlewares/telemetryMiddleware.js +0 -61
  143. package/bin/migrate.js +0 -54
  144. package/bin/og.js +0 -145
  145. package/bin/openApiCheck.js +0 -99
  146. package/bin/resolveFiles.js +0 -114
  147. package/bin/score/client.js +0 -40
  148. package/bin/score/index.js +0 -211
  149. package/bin/score/types.js +0 -1
  150. package/bin/signup.js +0 -118
  151. package/bin/start.js +0 -36
  152. package/bin/status.js +0 -106
  153. package/bin/telemetry/client.js +0 -53
  154. package/bin/telemetry/distinctId.js +0 -68
  155. package/bin/telemetry/sessionId.js +0 -36
  156. package/bin/telemetry/track.js +0 -149
  157. package/bin/templates.js +0 -127
  158. package/bin/tokenRefresh.js +0 -50
  159. package/bin/tsconfig.build.tsbuildinfo +0 -1
  160. package/bin/update.js +0 -65
  161. package/bin/validate/command.js +0 -127
  162. package/bin/validate/engine.js +0 -154
  163. package/bin/validate/files.js +0 -163
  164. package/bin/validate/mdx.js +0 -238
  165. package/bin/validate/output.js +0 -44
  166. package/bin/validate/report.js +0 -11
  167. package/bin/validate/rules/build.js +0 -102
  168. package/bin/validate/rules/content/duplicateH1.js +0 -57
  169. package/bin/validate/rules/content/foreignSyntax.js +0 -120
  170. package/bin/validate/rules/content/katex.js +0 -34
  171. package/bin/validate/rules/content/missingSnippet.js +0 -34
  172. package/bin/validate/rules/content/undefinedVariable.js +0 -13
  173. package/bin/validate/rules/content/unknownComponent.js +0 -121
  174. package/bin/validate/rules/content/voidTags.js +0 -38
  175. package/bin/validate/rules/index.js +0 -21
  176. package/bin/validate/rules/openapi.js +0 -50
  177. package/bin/validate/rules/parseError.js +0 -7
  178. package/bin/validate/site.js +0 -57
  179. package/bin/validate/types.js +0 -1
  180. package/bin/vendor/converter.js +0 -30882
  181. package/bin/welcome.js +0 -108
  182. package/bin/workflows/client.js +0 -34
  183. package/bin/workflows/index.js +0 -269
  184. package/bin/workflows/types.js +0 -11
  185. package/scripts/bundle-converter.mjs +0 -26
  186. package/scripts/generate-logo.mjs +0 -79
  187. package/src/accessibility.ts +0 -180
  188. package/src/accessibilityCheck.tsx +0 -150
  189. package/src/addDomain.tsx +0 -206
  190. package/src/agent-auth.ts +0 -119
  191. package/src/agent-claim.ts +0 -124
  192. package/src/agent-credentials.ts +0 -104
  193. package/src/agent-deployment.ts +0 -116
  194. package/src/agent-http.ts +0 -34
  195. package/src/agent-setup-config.ts +0 -144
  196. package/src/agent-setup.ts +0 -165
  197. package/src/agent.ts +0 -56
  198. package/src/analytics/client.ts +0 -153
  199. package/src/analytics/dates.ts +0 -6
  200. package/src/analytics/filters.ts +0 -50
  201. package/src/analytics/format.ts +0 -13
  202. package/src/analytics/index.tsx +0 -599
  203. package/src/analytics/output.ts +0 -99
  204. package/src/analytics/types.ts +0 -145
  205. package/src/authenticatedFetch.ts +0 -42
  206. package/src/brokenLinks.tsx +0 -152
  207. package/src/callbackServer.ts +0 -64
  208. package/src/cli.tsx +0 -1105
  209. package/src/comingSoon.tsx +0 -29
  210. package/src/config.ts +0 -75
  211. package/src/constants.ts +0 -28
  212. package/src/deploy-base.ts +0 -18
  213. package/src/deploy-github-actions.ts +0 -139
  214. package/src/deploy-github-setup.ts +0 -189
  215. package/src/deploy-instructions.ts +0 -76
  216. package/src/deploy.ts +0 -165
  217. package/src/feedback.tsx +0 -31
  218. package/src/format.tsx +0 -82
  219. package/src/helpers.tsx +0 -279
  220. package/src/idToken.ts +0 -17
  221. package/src/index.ts +0 -109
  222. package/src/init.tsx +0 -237
  223. package/src/instructions.ts +0 -99
  224. package/src/keyring.ts +0 -65
  225. package/src/login.tsx +0 -166
  226. package/src/logout.tsx +0 -8
  227. package/src/mdxAccessibility.ts +0 -134
  228. package/src/mdxLinter.tsx +0 -88
  229. package/src/middlewares/subdomainMiddleware.ts +0 -20
  230. package/src/middlewares/telemetryMiddleware.ts +0 -55
  231. package/src/migrate.ts +0 -76
  232. package/src/og.tsx +0 -185
  233. package/src/openApiCheck.tsx +0 -125
  234. package/src/resolveFiles.ts +0 -101
  235. package/src/score/client.ts +0 -36
  236. package/src/score/index.tsx +0 -205
  237. package/src/score/types.ts +0 -15
  238. package/src/signup.tsx +0 -172
  239. package/src/start.ts +0 -27
  240. package/src/status.tsx +0 -129
  241. package/src/telemetry/client.ts +0 -46
  242. package/src/telemetry/distinctId.ts +0 -70
  243. package/src/telemetry/sessionId.ts +0 -40
  244. package/src/telemetry/track.ts +0 -163
  245. package/src/templates.tsx +0 -143
  246. package/src/tokenRefresh.ts +0 -53
  247. package/src/update.tsx +0 -89
  248. package/src/validate/command.tsx +0 -135
  249. package/src/validate/engine.ts +0 -210
  250. package/src/validate/files.ts +0 -249
  251. package/src/validate/mdx.ts +0 -290
  252. package/src/validate/output.tsx +0 -76
  253. package/src/validate/report.ts +0 -40
  254. package/src/validate/rules/build.ts +0 -146
  255. package/src/validate/rules/content/duplicateH1.ts +0 -78
  256. package/src/validate/rules/content/foreignSyntax.ts +0 -144
  257. package/src/validate/rules/content/katex.ts +0 -33
  258. package/src/validate/rules/content/missingSnippet.ts +0 -36
  259. package/src/validate/rules/content/undefinedVariable.ts +0 -20
  260. package/src/validate/rules/content/unknownComponent.ts +0 -130
  261. package/src/validate/rules/content/voidTags.ts +0 -43
  262. package/src/validate/rules/index.ts +0 -23
  263. package/src/validate/rules/openapi.ts +0 -59
  264. package/src/validate/rules/parseError.ts +0 -9
  265. package/src/validate/site.ts +0 -53
  266. package/src/validate/types.ts +0 -102
  267. package/src/vendor/converter.ts +0 -1
  268. package/src/welcome.ts +0 -154
  269. package/src/workflows/client.ts +0 -39
  270. package/src/workflows/index.tsx +0 -287
  271. package/src/workflows/types.ts +0 -73
  272. package/tsconfig.build.json +0 -4
  273. package/tsconfig.json +0 -10
  274. package/vitest.config.ts +0 -9
@@ -1,238 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { coreRemark, FRONTMATTER_RE, getCodeRanges, HEADING_ID_RE, JSXParser, pagePathToSlug, replaceSlashIndex, safeCleanHeadingId, toPosixPath, } from '@mintlify/common';
11
- import { decorateGraphNodeFromPageContent, Node, PathType } from '@mintlify/link-rot';
12
- const HEADING_ID = new RegExp(HEADING_ID_RE.source, 'gm');
13
- const ESM_START = /^(?:import|export)(?=[\s{*])/;
14
- const JSX_TAG = /<[A-Za-z][\w.:-]*(?:"[^"]*"|'[^']*'|\{[^{}]*\}|[^<>"'{}])*>/g;
15
- const ATTR_VALUE = /"[^"]*"|'[^']*'|\{[^{}]*\}/g;
16
- export const hasCustomHeadingId = (line) => /\{\s*#[^}]+?\s*\}\s*$/.test(line);
17
- export const parseContent = (content) => {
18
- const padded = content.replace(HEADING_ID, (match, indent, hashes, text) => {
19
- const end = match.indexOf(text, indent.length + hashes.length) + text.length;
20
- return match.slice(0, end).padEnd(match.length, ' ');
21
- });
22
- return coreRemark().parse(padded);
23
- };
24
- const blankRanges = (content, ranges) => {
25
- let result = '';
26
- let cursor = 0;
27
- for (const [from, to] of [...ranges].sort((a, b) => a[0] - b[0])) {
28
- const start = Math.max(from, cursor);
29
- if (to <= start)
30
- continue;
31
- result += content.slice(cursor, start) + content.slice(start, to).replace(/[^\n]/g, ' ');
32
- cursor = to;
33
- }
34
- return result + content.slice(cursor);
35
- };
36
- const maskWith = (content, maskers) => maskers.reduce((text, ranges) => blankRanges(text, ranges(text)), content);
37
- const isCompleteEsm = (text) => {
38
- try {
39
- JSXParser.parse(text, { ecmaVersion: 'latest', sourceType: 'module' });
40
- return true;
41
- }
42
- catch (error) {
43
- const pos = error.pos;
44
- return typeof pos !== 'number' || pos < text.trimEnd().length;
45
- }
46
- };
47
- const frontmatterRanges = (content) => {
48
- const match = FRONTMATTER_RE.exec(content);
49
- return match ? [[match.index, match.index + match[0].length]] : [];
50
- };
51
- const esmRanges = (content, codeRanges) => {
52
- let esm;
53
- let previousBlank = true;
54
- const ranges = [];
55
- let offset = 0;
56
- for (const line of content.split('\n')) {
57
- const isBlank = line.trim() === '';
58
- const wasBlank = previousBlank;
59
- previousBlank = isBlank;
60
- if (esm) {
61
- if (isBlank && isCompleteEsm(esm.join('\n')))
62
- esm = undefined;
63
- else {
64
- esm.push(line);
65
- ranges.push([offset, offset + line.length]);
66
- }
67
- }
68
- else if (wasBlank &&
69
- ESM_START.test(line) &&
70
- !codeRanges.some(([start, end]) => start <= offset && offset < end)) {
71
- esm = [line];
72
- ranges.push([offset, offset + line.length]);
73
- }
74
- offset += line.length + 1;
75
- }
76
- return ranges;
77
- };
78
- export const maskFrontmatter = (content) => blankRanges(content, frontmatterRanges(content));
79
- export const maskCode = (content, { keepEsm = false } = {}) => {
80
- const codeRanges = getCodeRanges(content);
81
- return blankRanges(content, [
82
- ...frontmatterRanges(content),
83
- ...codeRanges,
84
- ...(keepEsm ? [] : esmRanges(content, codeRanges)),
85
- ]);
86
- };
87
- const OPENS = new Set(['{', '${']);
88
- const maskExpression = (content, start) => {
89
- const ranges = [];
90
- let depth = 0;
91
- try {
92
- const tokens = JSXParser.tokenizer(content.slice(start), {
93
- ecmaVersion: 'latest',
94
- onComment: (block, _text, from, to) => ranges.push([start + from + 2, start + to - (block ? 2 : 0)]),
95
- });
96
- for (const token of tokens) {
97
- const label = token.type.label;
98
- if (label === 'template')
99
- ranges.push([start + token.start, start + token.end]);
100
- else if (label === 'string')
101
- ranges.push([start + token.start + 1, start + token.end - 1]);
102
- else if (label === 'regexp') {
103
- const raw = content.slice(start + token.start, start + token.end);
104
- ranges.push([start + token.start + 1, start + token.start + raw.lastIndexOf('/')]);
105
- }
106
- else if (OPENS.has(label))
107
- depth++;
108
- else if (label === '}' && depth-- === 0)
109
- return { ranges, end: start + token.end };
110
- }
111
- }
112
- catch (error) {
113
- if (!(error instanceof SyntaxError && 'pos' in error && typeof error.pos === 'number')) {
114
- return { ranges, end: content.length };
115
- }
116
- const pos = start + error.pos;
117
- if (!error.message.startsWith('Unterminated string'))
118
- return { ranges, end: pos };
119
- const lineEnd = content.indexOf('\n', pos);
120
- ranges.push([pos + 1, lineEnd === -1 ? content.length : lineEnd]);
121
- }
122
- return { ranges, end: content.length };
123
- };
124
- const expressionRanges = (content) => {
125
- const ranges = [];
126
- for (let index = 0; index < content.length; index++) {
127
- const char = content[index];
128
- if (char === '\\')
129
- index++;
130
- else if (char === '{') {
131
- const expression = maskExpression(content, index + 1);
132
- ranges.push(...expression.ranges);
133
- index = expression.end - 1;
134
- }
135
- }
136
- return ranges;
137
- };
138
- const attributeRanges = (content) => [...content.matchAll(JSX_TAG)].flatMap(({ index, 0: tag }) => [...tag.matchAll(ATTR_VALUE)].map(({ index: at, 0: value }) => [index + at + 1, index + at + value.length - 1]));
139
- const escapedTagRanges = (content) => [...content.matchAll(/\\[\s\S]/g)].flatMap(({ index, 0: escape }) => escape === '\\<' ? [[index + 1, index + 2]] : []);
140
- export const maskNonMarkup = (content) => maskWith(maskCode(content), [attributeRanges, escapedTagRanges, expressionRanges]);
141
- export const selectEdits = (edits) => {
142
- const ordered = edits
143
- .map((edit, index) => ({ edit, index }))
144
- .sort((a, b) => b.edit.start - a.edit.start || b.edit.end - a.edit.end || b.index - a.index);
145
- const selected = [];
146
- let floor = Infinity;
147
- for (const { edit } of ordered) {
148
- if (edit.end > floor)
149
- continue;
150
- selected.push(edit);
151
- floor = edit.start;
152
- }
153
- return selected;
154
- };
155
- export const applyEdits = (content, edits) => selectEdits(edits).reduce((result, edit) => result.slice(0, edit.start) + edit.text + result.slice(edit.end), content);
156
- export const toOffset = (content, line, column = 1) => {
157
- let offset = 0;
158
- for (let current = 1; current < line; current++) {
159
- const next = content.indexOf('\n', offset);
160
- if (next === -1)
161
- break;
162
- offset = next + 1;
163
- }
164
- return offset + column - 1;
165
- };
166
- export const toPosition = (content, offset) => {
167
- var _a, _b;
168
- const before = content.slice(0, offset).split('\n');
169
- return { line: before.length, column: ((_b = (_a = before.pop()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + 1 };
170
- };
171
- const byStart = (a, b) => a.start - b.start;
172
- function toOriginal(edits, offset, inside) {
173
- let delta = 0;
174
- for (const edit of edits) {
175
- const start = edit.start + delta;
176
- if (inside === 'snap' ? offset < start : offset <= start)
177
- break;
178
- if (offset < start + edit.text.length)
179
- return inside === 'snap' ? edit.start : undefined;
180
- delta += edit.text.length - (edit.end - edit.start);
181
- }
182
- return offset - delta;
183
- }
184
- /** Maps an edit made against a later stage back to the original content, or undefined when it touches an earlier fix. */
185
- export const unmapEdit = (stages, index, edit) => {
186
- let { start, end } = edit;
187
- for (const { edits } of stages.slice(0, index).reverse()) {
188
- const sorted = [...edits].sort(byStart);
189
- const mappedStart = toOriginal(sorted, start, 'reject');
190
- const mappedEnd = toOriginal(sorted, end, 'reject');
191
- if (mappedStart === undefined || mappedEnd === undefined)
192
- return undefined;
193
- if (sorted.some((earlier) => earlier.start < mappedEnd && earlier.end > mappedStart)) {
194
- return undefined;
195
- }
196
- start = mappedStart;
197
- end = mappedEnd;
198
- }
199
- return { start, end, text: edit.text };
200
- };
201
- export const relocate = (stages, index, position) => {
202
- const stage = stages[index];
203
- const original = stages[0];
204
- if (!stage || !original || position.line === undefined)
205
- return {};
206
- const offset = stages
207
- .slice(0, index)
208
- .reduceRight((current, { edits }) => toOriginal([...edits].sort(byStart), current, 'snap'), toOffset(stage.content, position.line, position.column));
209
- const mapped = toPosition(original.content, offset);
210
- return position.column === undefined ? { line: mapped.line } : mapped;
211
- };
212
- const pagePath = (file) => replaceSlashIndex(pagePathToSlug(file)).replace(/^\.$/, '');
213
- export const collectAnchorLinks = (file, content) => __awaiter(void 0, void 0, void 0, function* () {
214
- const node = new Node(file);
215
- try {
216
- yield decorateGraphNodeFromPageContent(node, content);
217
- }
218
- catch (_a) {
219
- return [];
220
- }
221
- return node.paths.flatMap((link) => link.pathType === PathType.INTERNAL && link.anchorLink
222
- ? [
223
- `${pagePath(toPosixPath(link.toString()))}#${safeCleanHeadingId(link.anchorLink.slice(1))}`,
224
- ]
225
- : []);
226
- });
227
- export const linkedAnchor = (links, file, slug) => {
228
- const prefix = `${pagePath(file)}#`;
229
- for (const link of links !== null && links !== void 0 ? links : []) {
230
- if (!link.startsWith(prefix))
231
- continue;
232
- const anchor = link.slice(prefix.length);
233
- const suffix = anchor.startsWith(`${slug}-`) && /^\d/.test(anchor.slice(slug.length + 1));
234
- if (anchor === slug || suffix)
235
- return anchor;
236
- }
237
- return undefined;
238
- };
@@ -1,44 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { addLog, ErrorLog, InfoLog, SuccessLog } from '@mintlify/previewing';
3
- import { Box, Text } from 'ink';
4
- const preview = (value) => {
5
- const text = JSON.stringify(value);
6
- return text.length > 60 ? `${text.slice(0, 57)}..."` : text;
7
- };
8
- const location = ({ line, column }) => line ? `${line}${column ? `:${column}` : ''}` : '';
9
- const DiagnosticLine = ({ diagnostic }) => {
10
- const at = location(diagnostic);
11
- return (_jsxs(Text, { children: [' ', diagnostic.severity === 'error' ? (_jsx(Text, { color: "red", children: "\u2717" })) : (_jsx(Text, { color: "yellow", children: "!" })), ' ', at && _jsxs(Text, { dimColor: true, children: [at, " "] }), _jsx(Text, { dimColor: true, children: diagnostic.rule }), " ", diagnostic.message, diagnostic.fix && _jsx(Text, { dimColor: true, children: " (fixable)" })] }));
12
- };
13
- const plural = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`;
14
- export const logReport = (report) => {
15
- var _a, _b, _c;
16
- for (const change of (_a = report.fixed) !== null && _a !== void 0 ? _a : []) {
17
- addLog(_jsx(SuccessLog, { message: `fixed ${change.file}${change.line ? `:${change.line}` : ''} ${change.rule}: ${preview(change.before)} → ${preview(change.after)}` }));
18
- }
19
- const byFile = new Map();
20
- for (const diagnostic of report.diagnostics) {
21
- (_c = (_b = byFile.get(diagnostic.file)) === null || _b === void 0 ? void 0 : _b.push(diagnostic)) !== null && _c !== void 0 ? _c : byFile.set(diagnostic.file, [diagnostic]);
22
- }
23
- for (const [file, diagnostics] of byFile) {
24
- addLog(_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: file }), diagnostics.map((diagnostic, index) => (_jsx(DiagnosticLine, { diagnostic: diagnostic }, index)))] }));
25
- }
26
- const fixable = report.diagnostics.filter(({ fix }) => fix).length;
27
- if (fixable > 0 && !report.fixed) {
28
- addLog(_jsx(InfoLog, { message: `\`--fix\` would fix ${plural(fixable, 'issue')}.` }));
29
- }
30
- const { build } = report;
31
- if (build.ran && build.passed)
32
- addLog(_jsx(SuccessLog, { message: "build passed" }));
33
- else if (build.ran && report.passed)
34
- addLog(_jsx(InfoLog, { message: "build failed only on disabled rules" }));
35
- else if (build.ran)
36
- addLog(_jsx(ErrorLog, { message: "build failed" }));
37
- else if (build.reason === 'errors found')
38
- addLog(_jsx(InfoLog, { message: "build skipped until the errors above are fixed" }));
39
- const { errors, warnings } = report.summary;
40
- const warned = plural(warnings, 'warning');
41
- const passed = warnings > 0 ? `passed with ${warned}` : 'validation passed';
42
- const failed = `${plural(errors, 'error')}${warnings > 0 ? `, ${warned}` : ''}`;
43
- addLog(report.passed ? _jsx(SuccessLog, { message: passed }) : _jsx(ErrorLog, { message: failed }));
44
- };
@@ -1,11 +0,0 @@
1
- export const toReport = (diagnostics, build, fixed) => {
2
- var _a;
3
- const byRule = {};
4
- for (const { rule } of diagnostics)
5
- byRule[rule] = ((_a = byRule[rule]) !== null && _a !== void 0 ? _a : 0) + 1;
6
- const errors = diagnostics.filter(({ severity }) => severity === 'error').length;
7
- return Object.assign({ passed: errors === 0, summary: { errors, warnings: diagnostics.length - errors, byRule }, diagnostics: diagnostics.map(({ rule, group, severity, file, line, column, message, fix }) => (Object.assign(Object.assign(Object.assign(Object.assign({ rule,
8
- group,
9
- severity,
10
- file }, (line !== undefined && { line })), (column !== undefined && { column })), { message }), (fix && { fix })))), build }, (fixed && { fixed }));
11
- };
@@ -1,102 +0,0 @@
1
- import { normalizeRelativePath, toPosixPath } from '@mintlify/common';
2
- import { stripVTControlCharacters } from 'node:util';
3
- const FILE = String.raw `[\w@.\\/-]+\.(?:mdx?|jsx?|tsx?|json|ya?ml)\b`;
4
- const FILE_IN_MESSAGE = new RegExp(FILE);
5
- const IMPORTERS = [
6
- new RegExp(String.raw `\(in (${FILE}),`),
7
- new RegExp(String.raw `(?:\bin|imported from) (${FILE})`),
8
- ];
9
- const IMPORT_TYPES = new Set([
10
- 'missing-file',
11
- 'invalid-import-path',
12
- 'import-resolution-error',
13
- 'default-import-no-default-export',
14
- 'export-collision',
15
- 'undeclared-package',
16
- 'package-import-conflict',
17
- ]);
18
- const POSITION = /^:(\d+)(?::(\d+))?/;
19
- const QUOTED = /"([^"]+)"/;
20
- const toFinding = (site, warning) => {
21
- var _a, _b;
22
- const clean = stripVTControlCharacters(warning.message).trim();
23
- const importer = warning.file == null && IMPORT_TYPES.has(warning.type)
24
- ? IMPORTERS.map((pattern) => { var _a; return (_a = pattern.exec(clean)) === null || _a === void 0 ? void 0 : _a[1]; }).find(Boolean)
25
- : undefined;
26
- // Missing nav pages are always about the config, even when the page looks like a file
27
- const match = warning.file != null || importer || warning.type === 'missing-nav-page'
28
- ? null
29
- : FILE_IN_MESSAGE.exec(clean);
30
- const found = importer !== null && importer !== void 0 ? importer : match === null || match === void 0 ? void 0 : match[0];
31
- const file = (_a = warning.file) !== null && _a !== void 0 ? _a : (found ? normalizeRelativePath(toPosixPath(found)) : site.configFile);
32
- const position = match ? POSITION.exec(clean.slice(match.index + match[0].length)) : null;
33
- // Config warnings quote the entry they're about, such as a navigation page
34
- const quoted = warning.file == null && file === site.configFile ? (_b = QUOTED.exec(clean)) === null || _b === void 0 ? void 0 : _b[0] : undefined;
35
- const located = warning.ref != null && warning.line == null
36
- ? site.locate(file, JSON.stringify(warning.ref))
37
- : quoted
38
- ? site.locate(file, quoted)
39
- : undefined;
40
- return Object.assign(Object.assign(Object.assign({ file }, (warning.line != null
41
- ? Object.assign({ line: warning.line }, (warning.column != null && { column: warning.column })) : position && Object.assign({ line: Number(position[1]) }, (position[2] && { column: Number(position[2]) })))), located), { message: clean });
42
- };
43
- /** Warning types some rule turns into diagnostics, so a strict-build failure is explained. */
44
- const COVERED_TYPES = new Set(['parse-error']);
45
- const buildRule = (id, group, types, description) => {
46
- for (const type of types)
47
- COVERED_TYPES.add(type);
48
- return {
49
- id,
50
- group,
51
- severity: 'error',
52
- needsBuild: true,
53
- scope: 'site',
54
- description,
55
- check: (site) => {
56
- var _a, _b;
57
- return ((_b = (_a = site.build) === null || _a === void 0 ? void 0 : _a.warnings) !== null && _b !== void 0 ? _b : [])
58
- .filter(({ type }) => types.includes(type))
59
- .map((warning) => toFinding(site, warning));
60
- },
61
- };
62
- };
63
- export const BUILD_RULES = [
64
- buildRule('missing-nav-page', 'nav', ['missing-nav-page'], 'pages in the navigation that have no file'),
65
- buildRule('missing-file', 'content', ['missing-file'], "imported files that don't exist"),
66
- buildRule('import-error', 'content', [
67
- 'invalid-import-path',
68
- 'import-resolution-error',
69
- 'default-import-no-default-export',
70
- 'export-collision',
71
- ], "imports in pages and snippets that don't resolve"),
72
- buildRule('package-import', 'config', ['undeclared-package', 'package-import-conflict'], 'npm package imports that are undeclared or conflict'),
73
- buildRule('openapi-build', 'openapi', ['openapi'], 'OpenAPI pages the build could not generate'),
74
- {
75
- id: 'build-failed',
76
- group: 'config',
77
- severity: 'error',
78
- needsBuild: true,
79
- scope: 'site',
80
- description: 'the strict build failed for a reason no rule reports',
81
- check: (site) => {
82
- if (!site.build || site.build.passed)
83
- return [];
84
- const unreported = (warning) => warning.type === 'parse-error' &&
85
- site.selected !== undefined &&
86
- !site.selected.has(toFinding(site, warning).file);
87
- const uncovered = site.build.warnings.filter((warning) => !COVERED_TYPES.has(warning.type) || unreported(warning));
88
- const findings = uncovered.map((warning) => toFinding(site, warning));
89
- // Covered warnings are the selected rules' to report; disabled ones are meant to pass
90
- return site.build.strict
91
- ? findings
92
- : [...findings, { file: site.configFile, message: site.build.error }];
93
- },
94
- },
95
- ];
96
- /** Build warnings of one type, which the engine merges into the static rule that covers them. */
97
- export const buildFindings = (site, type) => {
98
- var _a, _b;
99
- return ((_b = (_a = site.build) === null || _a === void 0 ? void 0 : _a.warnings) !== null && _b !== void 0 ? _b : [])
100
- .filter((warning) => warning.type === type)
101
- .map((warning) => toFinding(site, warning));
102
- };
@@ -1,57 +0,0 @@
1
- import { AVOIDED_PAGE_MODES, getTableOfContentsTitle, safeCleanHeadingId, slugify, } from '@mintlify/common';
2
- import remarkSmartypants from 'remark-smartypants';
3
- import { unified } from 'unified';
4
- import { hasCustomHeadingId, linkedAnchor } from '../../mdx.js';
5
- const normalize = (value) => value.trim().replace(/\s+/g, ' ');
6
- const smartypants = unified().use(remarkSmartypants);
7
- const firstHeading = (tree) => tree.children.find((node) => node.type === 'heading');
8
- const renderedText = (heading) => {
9
- const clone = structuredClone(heading);
10
- const root = { type: 'root', children: [clone] };
11
- smartypants.runSync(root);
12
- return getTableOfContentsTitle(clone);
13
- };
14
- export const duplicateH1 = {
15
- id: 'duplicate-h1',
16
- group: 'content',
17
- severity: 'warning',
18
- scope: 'file',
19
- description: 'remove a first heading that repeats the frontmatter title',
20
- pagesOnly: true,
21
- needsAnchorLinks: true,
22
- check: ({ tree, frontmatter, content, file, anchorLinks }) => {
23
- var _a, _b, _c, _d, _e, _f, _g, _h;
24
- const { title, mode } = frontmatter;
25
- if (typeof title !== 'string' || AVOIDED_PAGE_MODES.includes(String(mode)))
26
- return [];
27
- const first = firstHeading(tree);
28
- if (!first || first.depth !== 1)
29
- return [];
30
- if (normalize(getTableOfContentsTitle(first)) !== normalize(title))
31
- return [];
32
- const start = (_b = (_a = first.position) === null || _a === void 0 ? void 0 : _a.start.offset) !== null && _b !== void 0 ? _b : 0;
33
- const end = (_d = (_c = first.position) === null || _c === void 0 ? void 0 : _c.end.offset) !== null && _d !== void 0 ? _d : start;
34
- const location = {
35
- line: (_e = first.position) === null || _e === void 0 ? void 0 : _e.start.line,
36
- column: (_f = first.position) === null || _f === void 0 ? void 0 : _f.start.column,
37
- };
38
- const lineEnd = content.indexOf('\n', start);
39
- if (hasCustomHeadingId(content.slice(start, lineEnd === -1 ? undefined : lineEnd))) {
40
- return [
41
- Object.assign(Object.assign({}, location), { message: 'first heading duplicates the frontmatter title; it has a custom {#id}, so remove it by hand and update links to it' }),
42
- ];
43
- }
44
- const anchor = [renderedText(first), getTableOfContentsTitle(first)]
45
- .map((text) => linkedAnchor(anchorLinks, file, safeCleanHeadingId(slugify(text))))
46
- .find((linked) => linked !== undefined);
47
- if (anchor !== undefined) {
48
- return [
49
- Object.assign(Object.assign({}, location), { message: `first heading duplicates the frontmatter title; links point to #${anchor}, so remove it by hand and update them` }),
50
- ];
51
- }
52
- const trailing = (_h = (_g = /^\n*/.exec(content.slice(end))) === null || _g === void 0 ? void 0 : _g[0].length) !== null && _h !== void 0 ? _h : 0;
53
- return [
54
- Object.assign(Object.assign({}, location), { message: 'first heading duplicates the frontmatter title', edit: { start, end: end + trailing, text: '' } }),
55
- ];
56
- },
57
- };
@@ -1,120 +0,0 @@
1
- import { maskCode, maskFrontmatter, maskNonMarkup, toPosition } from '../../mdx.js';
2
- const CALLOUTS = {
3
- note: '<Note>',
4
- info: '<Info>',
5
- tip: '<Tip>',
6
- hint: '<Tip>',
7
- success: '<Check>',
8
- important: '<Note>',
9
- warning: '<Warning>',
10
- caution: '<Warning>',
11
- danger: '<Warning>',
12
- error: '<Warning>',
13
- details: '<Accordion>',
14
- };
15
- const callout = (name) => { var _a, _b; return (_b = CALLOUTS[(_a = name === null || name === void 0 ? void 0 : name.toLowerCase()) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : 'a callout (<Note>, <Info>, <Tip> or <Warning>)'; };
16
- const LIQUID_TAGS = {
17
- hint: 'a callout (<Note>, <Info>, <Tip> or <Warning>)',
18
- tabs: '<Tabs>',
19
- tab: '<Tab title="…">',
20
- stepper: '<Steps>',
21
- step: '<Step title="…">',
22
- embed: 'a link or <Frame>',
23
- 'content-ref': '<Card>',
24
- include: 'a snippet import',
25
- code: 'a fenced code block',
26
- file: 'a link to the file',
27
- swagger: 'an OpenAPI page',
28
- openapi: 'an OpenAPI page',
29
- };
30
- const PATTERNS = [
31
- {
32
- regex: /\{%-?\s*(?!end)([\w-]+)[^%\n]*?-?%\}/g,
33
- message: ([tag, name]) => {
34
- var _a, _b;
35
- const style = name === 'hint' ? (_a = /style=["']?(\w+)/.exec(tag)) === null || _a === void 0 ? void 0 : _a[1] : undefined;
36
- const target = style
37
- ? callout(style)
38
- : ((_b = LIQUID_TAGS[name !== null && name !== void 0 ? name : '']) !== null && _b !== void 0 ? _b : 'Markdown or a Mintlify component');
39
- return `${tag} is a GitBook or Liquid tag, which Mintlify does not support; use ${target}`;
40
- },
41
- },
42
- {
43
- regex: /\{\{[<%]\s*([\w/-]+)[^}\n]*[>%]\}\}/g,
44
- message: ([tag]) => `${tag} is a Hugo shortcode, which Mintlify does not support; use Markdown or a Mintlify component`,
45
- },
46
- {
47
- regex: /\{\{-?\s*(?:(?:site|page|layout|include|jekyll|paginator)\.[^}\n]*|[^\s|{}]+\s*\|\s*\w+[^}\n]*)-?\}\}/g,
48
- message: ([tag]) => `${tag} is a Liquid variable, which Mintlify does not support; write the value, or use a snippet or a variable`,
49
- },
50
- {
51
- regex: /^ {0,3}:{3,}\s*([A-Za-z][\w-]*)/gm,
52
- message: ([, name]) => `:::${name} is a Docusaurus or VitePress admonition, which Mintlify does not support; use ${callout(name)}`,
53
- },
54
- {
55
- regex: /^ {0,3}::(?!:)([A-Za-z][\w-]*)/gm,
56
- message: ([, name]) => `::${name} is an MDC (Nuxt Content, Docus) block, which Mintlify does not support; use the matching Mintlify component`,
57
- },
58
- {
59
- regex: /^ {0,3}(!!!|\?\?\?\+?)[ \t]+([A-Za-z][\w-]*)/gm,
60
- message: ([, marker, name]) => `${marker} ${name} is an MkDocs admonition, which Mintlify does not support; use ${marker === '!!!' ? callout(name) : '<Accordion>'}`,
61
- },
62
- {
63
- regex: /^ {0,3}===\+?[ \t]+["']/gm,
64
- message: () => `=== "…" is an MkDocs content tab, which Mintlify does not support; use <Tabs> with <Tab title="…">`,
65
- },
66
- {
67
- regex: /^[ \t]*;?[ \t]*--8<--/gm,
68
- scope: 'everything',
69
- message: () => '--8<-- is an MkDocs snippet include, which Mintlify does not support; use a snippet import or paste the content',
70
- },
71
- {
72
- regex: /\{:\s*[.#\w][^}\n]*\}/g,
73
- message: ([list]) => `${list} is a Kramdown attribute list, which Mintlify does not support; remove it, use a component, or use {#id} for a heading anchor`,
74
- },
75
- {
76
- regex: /(?<![[{\w])\[\[([^[\]\n]+)\]\](?![(:[])/g,
77
- message: ([link]) => `${link} is a wiki link, which Mintlify does not support; use a Markdown link such as [text](/path)`,
78
- },
79
- {
80
- regex: /(?:\]\(|href=["'])((?:doc|ref|blog|changelog|page):[^)\s"']+)/g,
81
- scope: 'links',
82
- message: ([, link]) => {
83
- var _a;
84
- return `${link} is a ReadMe link, which Mintlify does not support; link to the page path instead, such as /${(_a = link === null || link === void 0 ? void 0 : link.split(':')[1]) !== null && _a !== void 0 ? _a : ''}`;
85
- },
86
- },
87
- {
88
- regex: /["'(]@site\/[^"')\s]*/g,
89
- scope: 'prose-and-esm',
90
- message: ([path]) => `${path.slice(1)} uses the Docusaurus @site alias, which Mintlify does not resolve; use a root-relative path such as /images/… or /snippets/…`,
91
- },
92
- ];
93
- export const foreignSyntax = {
94
- id: 'foreign-syntax',
95
- group: 'content',
96
- severity: 'warning',
97
- scope: 'file',
98
- description: "syntax from another docs framework that Mintlify doesn't render",
99
- raw: true,
100
- check: ({ content }) => {
101
- const prose = maskCode(content);
102
- const literal = maskNonMarkup(content);
103
- const views = {
104
- prose,
105
- links: prose,
106
- 'prose-and-esm': maskCode(content, { keepEsm: true }),
107
- everything: maskFrontmatter(content),
108
- };
109
- const issues = [];
110
- for (const { regex, scope = 'prose', message } of PATTERNS) {
111
- for (const match of views[scope].matchAll(regex)) {
112
- const start = match.index + (match[0].length - match[0].trimStart().length);
113
- if (scope === 'prose' && literal[start] !== prose[start])
114
- continue;
115
- issues.push(Object.assign(Object.assign({}, toPosition(content, start)), { message: message(match) }));
116
- }
117
- }
118
- return issues;
119
- },
120
- };
@@ -1,34 +0,0 @@
1
- import { isCurrencyMath } from '@mintlify/common';
2
- import katex from 'katex';
3
- import { visit } from 'unist-util-visit';
4
- export const katexRule = {
5
- id: 'katex',
6
- group: 'content',
7
- severity: 'warning',
8
- scope: 'file',
9
- description: "math that KaTeX can't render",
10
- check: ({ tree, content }) => {
11
- const issues = [];
12
- visit(tree, (node) => {
13
- var _a, _b;
14
- if (node.type !== 'math' && node.type !== 'inlineMath')
15
- return;
16
- if (node.type === 'inlineMath' && isCurrencyMath(node, content))
17
- return;
18
- try {
19
- katex.renderToString(node.value, {
20
- throwOnError: true,
21
- displayMode: node.type === 'math',
22
- });
23
- }
24
- catch (error) {
25
- issues.push({
26
- line: (_a = node.position) === null || _a === void 0 ? void 0 : _a.start.line,
27
- column: (_b = node.position) === null || _b === void 0 ? void 0 : _b.start.column,
28
- message: error instanceof Error ? error.message : 'invalid math',
29
- });
30
- }
31
- });
32
- return issues;
33
- },
34
- };
@@ -1,34 +0,0 @@
1
- import { replaceVariables } from '@mintlify/common';
2
- import { visit } from 'unist-util-visit';
3
- const exists = (file, readFile) => !file.startsWith('/') &&
4
- (readFile(`_snippets/${file}`) !== undefined ||
5
- (file.startsWith('snippets/') && readFile(file) !== undefined));
6
- export const missingSnippet = {
7
- id: 'missing-snippet',
8
- group: 'content',
9
- severity: 'error',
10
- scope: 'file',
11
- description: '<Snippet file> tags whose file the build cannot find',
12
- check: ({ tree, readFile, variables }) => {
13
- if (!readFile)
14
- return [];
15
- const issues = [];
16
- visit(tree, 'mdxJsxFlowElement', (node) => {
17
- var _a, _b, _c;
18
- if (node.name !== 'Snippet')
19
- return;
20
- const value = (_a = node.attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'file')) === null || _a === void 0 ? void 0 : _a.value;
21
- if (typeof value !== 'string')
22
- return;
23
- const file = replaceVariables(value, variables);
24
- if (exists(file, readFile))
25
- return;
26
- issues.push({
27
- line: (_b = node.position) === null || _b === void 0 ? void 0 : _b.start.line,
28
- column: (_c = node.position) === null || _c === void 0 ? void 0 : _c.start.column,
29
- message: `<Snippet file="${value}"> renders nothing: no snippet matches "${file}"`,
30
- });
31
- });
32
- return issues;
33
- },
34
- };
@@ -1,13 +0,0 @@
1
- import { maskCode, toPosition } from '../../mdx.js';
2
- const VARIABLE = /(?<!=\s*)\{\{\s*([\w.\-]+)\s*\}\}/g;
3
- export const undefinedVariable = {
4
- id: 'undefined-variable',
5
- group: 'content',
6
- severity: 'error',
7
- scope: 'file',
8
- description: '{{variables}} that docs.json does not define',
9
- raw: true,
10
- check: ({ content, variables = {} }) => [...maskCode(content).matchAll(VARIABLE)]
11
- .filter(([, name]) => name !== undefined && variables[name] === undefined)
12
- .map((match) => (Object.assign(Object.assign({}, toPosition(content, match.index)), { message: `{{${match[1]}}} is not defined in the variables of docs.json` }))),
13
- };