@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.
- package/dist/assets/export-scripts/README.classic.md +15 -0
- package/dist/assets/export-scripts/README.md +14 -0
- package/dist/assets/export-scripts/serve.js +114 -0
- package/dist/assets/export-scripts/start-docs.bat +10 -0
- package/dist/assets/export-scripts/start-docs.sh +9 -0
- package/dist/assets/og/Inter-Bold.ttf +0 -0
- package/dist/assets/og/Inter-Medium.ttf +0 -0
- package/dist/assets/og/Inter-Regular.ttf +0 -0
- package/dist/assets/og/Inter-SemiBold.ttf +0 -0
- package/dist/assets/og/PaperMono-Regular.ttf +0 -0
- package/dist/assets/og/index_bg.wasm +0 -0
- package/dist/assets/openChrome.applescript +94 -0
- package/dist/assets/socket.io/socket.io.esm.min.js +7 -0
- package/dist/assets/socket.io/socket.io.esm.min.js.map +1 -0
- package/dist/assets/socket.io/socket.io.js +4907 -0
- package/dist/assets/socket.io/socket.io.js.map +1 -0
- package/dist/assets/socket.io/socket.io.min.js +7 -0
- package/dist/assets/socket.io/socket.io.min.js.map +1 -0
- package/dist/assets/socket.io/socket.io.msgpack.min.js +7 -0
- package/dist/assets/socket.io/socket.io.msgpack.min.js.map +1 -0
- package/dist/assets/xdg-open +1066 -0
- package/dist/assets/yargs-locales/be.json +46 -0
- package/dist/assets/yargs-locales/cs.json +51 -0
- package/dist/assets/yargs-locales/de.json +46 -0
- package/dist/assets/yargs-locales/en.json +55 -0
- package/dist/assets/yargs-locales/es.json +46 -0
- package/dist/assets/yargs-locales/fi.json +49 -0
- package/dist/assets/yargs-locales/fr.json +53 -0
- package/dist/assets/yargs-locales/hi.json +49 -0
- package/dist/assets/yargs-locales/hu.json +46 -0
- package/dist/assets/yargs-locales/id.json +50 -0
- package/dist/assets/yargs-locales/it.json +46 -0
- package/dist/assets/yargs-locales/ja.json +51 -0
- package/dist/assets/yargs-locales/ko.json +49 -0
- package/dist/assets/yargs-locales/nb.json +44 -0
- package/dist/assets/yargs-locales/nl.json +49 -0
- package/dist/assets/yargs-locales/nn.json +44 -0
- package/dist/assets/yargs-locales/pirate.json +13 -0
- package/dist/assets/yargs-locales/pl.json +49 -0
- package/dist/assets/yargs-locales/pt.json +45 -0
- package/dist/assets/yargs-locales/pt_BR.json +48 -0
- package/dist/assets/yargs-locales/ru.json +51 -0
- package/dist/assets/yargs-locales/th.json +46 -0
- package/dist/assets/yargs-locales/tr.json +48 -0
- package/dist/assets/yargs-locales/uk_UA.json +51 -0
- package/dist/assets/yargs-locales/uz.json +52 -0
- package/dist/assets/yargs-locales/zh_CN.json +48 -0
- package/dist/assets/yargs-locales/zh_TW.json +51 -0
- package/dist/converter-d8O3xkdU.js +102 -0
- package/dist/devtools-CGNZQKFV.js +24 -0
- package/dist/index.js +8 -0
- package/dist/rolldown-runtime-CEAe2Uac.js +7 -0
- package/dist/schemas-CBsmCNpK.js +372 -0
- package/dist/start.js +2310 -0
- package/package.json +43 -36
- package/.oxlintrc.json +0 -5
- package/.prettierignore +0 -2
- package/.turbo/turbo-build.log +0 -1
- package/CONTRIBUTING.md +0 -45
- package/__test__/agent-auth.test.ts +0 -114
- package/__test__/agent-claim.test.ts +0 -164
- package/__test__/agent-credentials.test.ts +0 -149
- package/__test__/agent-deployment.test.ts +0 -106
- package/__test__/agent-setup-config.test.ts +0 -324
- package/__test__/agent-setup.test.ts +0 -207
- package/__test__/agent.test.ts +0 -64
- package/__test__/analytics/client.test.ts +0 -180
- package/__test__/analytics/dates.test.ts +0 -12
- package/__test__/analytics/filters.test.ts +0 -116
- package/__test__/analytics/format.test.ts +0 -137
- package/__test__/authenticatedFetch.test.ts +0 -182
- package/__test__/brokenLinks.test.ts +0 -283
- package/__test__/checkPort.test.ts +0 -92
- package/__test__/deploy-github-actions.test.ts +0 -202
- package/__test__/deploy-github-setup.test.ts +0 -240
- package/__test__/deploy-instructions.test.ts +0 -155
- package/__test__/deploy.test.ts +0 -202
- package/__test__/feedback.test.ts +0 -34
- package/__test__/foreignSyntax.test.ts +0 -73
- package/__test__/format.test.ts +0 -72
- package/__test__/helpers.test.ts +0 -52
- package/__test__/init.test.ts +0 -119
- package/__test__/instructions.test.ts +0 -53
- package/__test__/keyring.test.ts +0 -82
- package/__test__/mdxAccessibility.test.ts +0 -81
- package/__test__/migrate.test.ts +0 -186
- package/__test__/openApiCheck.test.ts +0 -185
- package/__test__/pathValidation.test.ts +0 -25
- package/__test__/resolveFiles.test.ts +0 -70
- package/__test__/sessionId.test.ts +0 -46
- package/__test__/signup.test.ts +0 -36
- package/__test__/update.test.ts +0 -117
- package/__test__/utils.ts +0 -25
- package/__test__/validateCommand.test.ts +0 -647
- package/__test__/validateEngine.test.ts +0 -245
- package/__test__/validateRules.test.ts +0 -1275
- package/__test__/welcome.test.ts +0 -15
- package/__test__/workflows/client.test.ts +0 -126
- package/bin/accessibility.js +0 -111
- package/bin/accessibilityCheck.js +0 -82
- package/bin/addDomain.js +0 -130
- package/bin/agent-auth.js +0 -104
- package/bin/agent-claim.js +0 -97
- package/bin/agent-credentials.js +0 -124
- package/bin/agent-deployment.js +0 -96
- package/bin/agent-http.js +0 -45
- package/bin/agent-setup-config.js +0 -141
- package/bin/agent-setup.js +0 -146
- package/bin/agent.js +0 -42
- package/bin/analytics/client.js +0 -60
- package/bin/analytics/dates.js +0 -6
- package/bin/analytics/filters.js +0 -27
- package/bin/analytics/format.js +0 -13
- package/bin/analytics/index.js +0 -496
- package/bin/analytics/output.js +0 -75
- package/bin/analytics/types.js +0 -1
- package/bin/authenticatedFetch.js +0 -46
- package/bin/brokenLinks.js +0 -122
- package/bin/callbackServer.js +0 -65
- package/bin/cli.js +0 -813
- package/bin/comingSoon.js +0 -26
- package/bin/config.js +0 -78
- package/bin/constants.js +0 -16
- package/bin/deploy-base.js +0 -20
- package/bin/deploy-github-actions.js +0 -102
- package/bin/deploy-github-setup.js +0 -165
- package/bin/deploy-instructions.js +0 -71
- package/bin/deploy.js +0 -123
- package/bin/feedback.js +0 -36
- package/bin/format.js +0 -121
- package/bin/helpers.js +0 -238
- package/bin/idToken.js +0 -14
- package/bin/index.js +0 -102
- package/bin/init.js +0 -182
- package/bin/instructions.js +0 -101
- package/bin/keyring.js +0 -78
- package/bin/login.js +0 -123
- package/bin/logout.js +0 -18
- package/bin/mdxAccessibility.js +0 -113
- package/bin/mdxLinter.js +0 -55
- package/bin/middlewares/subdomainMiddleware.js +0 -28
- package/bin/middlewares/telemetryMiddleware.js +0 -61
- package/bin/migrate.js +0 -54
- package/bin/og.js +0 -145
- package/bin/openApiCheck.js +0 -99
- package/bin/resolveFiles.js +0 -114
- package/bin/score/client.js +0 -40
- package/bin/score/index.js +0 -211
- package/bin/score/types.js +0 -1
- package/bin/signup.js +0 -118
- package/bin/start.js +0 -36
- package/bin/status.js +0 -106
- package/bin/telemetry/client.js +0 -53
- package/bin/telemetry/distinctId.js +0 -68
- package/bin/telemetry/sessionId.js +0 -36
- package/bin/telemetry/track.js +0 -149
- package/bin/templates.js +0 -127
- package/bin/tokenRefresh.js +0 -50
- package/bin/tsconfig.build.tsbuildinfo +0 -1
- package/bin/update.js +0 -65
- package/bin/validate/command.js +0 -127
- package/bin/validate/engine.js +0 -154
- package/bin/validate/files.js +0 -163
- package/bin/validate/mdx.js +0 -238
- package/bin/validate/output.js +0 -44
- package/bin/validate/report.js +0 -11
- package/bin/validate/rules/build.js +0 -102
- package/bin/validate/rules/content/duplicateH1.js +0 -57
- package/bin/validate/rules/content/foreignSyntax.js +0 -120
- package/bin/validate/rules/content/katex.js +0 -34
- package/bin/validate/rules/content/missingSnippet.js +0 -34
- package/bin/validate/rules/content/undefinedVariable.js +0 -13
- package/bin/validate/rules/content/unknownComponent.js +0 -121
- package/bin/validate/rules/content/voidTags.js +0 -38
- package/bin/validate/rules/index.js +0 -21
- package/bin/validate/rules/openapi.js +0 -50
- package/bin/validate/rules/parseError.js +0 -7
- package/bin/validate/site.js +0 -57
- package/bin/validate/types.js +0 -1
- package/bin/vendor/converter.js +0 -30882
- package/bin/welcome.js +0 -108
- package/bin/workflows/client.js +0 -34
- package/bin/workflows/index.js +0 -269
- package/bin/workflows/types.js +0 -11
- package/scripts/bundle-converter.mjs +0 -26
- package/scripts/generate-logo.mjs +0 -79
- package/src/accessibility.ts +0 -180
- package/src/accessibilityCheck.tsx +0 -150
- package/src/addDomain.tsx +0 -206
- package/src/agent-auth.ts +0 -119
- package/src/agent-claim.ts +0 -124
- package/src/agent-credentials.ts +0 -104
- package/src/agent-deployment.ts +0 -116
- package/src/agent-http.ts +0 -34
- package/src/agent-setup-config.ts +0 -144
- package/src/agent-setup.ts +0 -165
- package/src/agent.ts +0 -56
- package/src/analytics/client.ts +0 -153
- package/src/analytics/dates.ts +0 -6
- package/src/analytics/filters.ts +0 -50
- package/src/analytics/format.ts +0 -13
- package/src/analytics/index.tsx +0 -599
- package/src/analytics/output.ts +0 -99
- package/src/analytics/types.ts +0 -145
- package/src/authenticatedFetch.ts +0 -42
- package/src/brokenLinks.tsx +0 -152
- package/src/callbackServer.ts +0 -64
- package/src/cli.tsx +0 -1105
- package/src/comingSoon.tsx +0 -29
- package/src/config.ts +0 -75
- package/src/constants.ts +0 -28
- package/src/deploy-base.ts +0 -18
- package/src/deploy-github-actions.ts +0 -139
- package/src/deploy-github-setup.ts +0 -189
- package/src/deploy-instructions.ts +0 -76
- package/src/deploy.ts +0 -165
- package/src/feedback.tsx +0 -31
- package/src/format.tsx +0 -82
- package/src/helpers.tsx +0 -279
- package/src/idToken.ts +0 -17
- package/src/index.ts +0 -109
- package/src/init.tsx +0 -237
- package/src/instructions.ts +0 -99
- package/src/keyring.ts +0 -65
- package/src/login.tsx +0 -166
- package/src/logout.tsx +0 -8
- package/src/mdxAccessibility.ts +0 -134
- package/src/mdxLinter.tsx +0 -88
- package/src/middlewares/subdomainMiddleware.ts +0 -20
- package/src/middlewares/telemetryMiddleware.ts +0 -55
- package/src/migrate.ts +0 -76
- package/src/og.tsx +0 -185
- package/src/openApiCheck.tsx +0 -125
- package/src/resolveFiles.ts +0 -101
- package/src/score/client.ts +0 -36
- package/src/score/index.tsx +0 -205
- package/src/score/types.ts +0 -15
- package/src/signup.tsx +0 -172
- package/src/start.ts +0 -27
- package/src/status.tsx +0 -129
- package/src/telemetry/client.ts +0 -46
- package/src/telemetry/distinctId.ts +0 -70
- package/src/telemetry/sessionId.ts +0 -40
- package/src/telemetry/track.ts +0 -163
- package/src/templates.tsx +0 -143
- package/src/tokenRefresh.ts +0 -53
- package/src/update.tsx +0 -89
- package/src/validate/command.tsx +0 -135
- package/src/validate/engine.ts +0 -210
- package/src/validate/files.ts +0 -249
- package/src/validate/mdx.ts +0 -290
- package/src/validate/output.tsx +0 -76
- package/src/validate/report.ts +0 -40
- package/src/validate/rules/build.ts +0 -146
- package/src/validate/rules/content/duplicateH1.ts +0 -78
- package/src/validate/rules/content/foreignSyntax.ts +0 -144
- package/src/validate/rules/content/katex.ts +0 -33
- package/src/validate/rules/content/missingSnippet.ts +0 -36
- package/src/validate/rules/content/undefinedVariable.ts +0 -20
- package/src/validate/rules/content/unknownComponent.ts +0 -130
- package/src/validate/rules/content/voidTags.ts +0 -43
- package/src/validate/rules/index.ts +0 -23
- package/src/validate/rules/openapi.ts +0 -59
- package/src/validate/rules/parseError.ts +0 -9
- package/src/validate/site.ts +0 -53
- package/src/validate/types.ts +0 -102
- package/src/vendor/converter.ts +0 -1
- package/src/welcome.ts +0 -154
- package/src/workflows/client.ts +0 -39
- package/src/workflows/index.tsx +0 -287
- package/src/workflows/types.ts +0 -73
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -10
- package/vitest.config.ts +0 -9
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { maskCode, maskFrontmatter, maskNonMarkup, toPosition } from '../../mdx.js';
|
|
2
|
-
import type { FileRule, FileFinding } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
type Pattern = {
|
|
5
|
-
regex: RegExp;
|
|
6
|
-
scope?: 'prose' | 'links' | 'prose-and-esm' | 'everything';
|
|
7
|
-
message: (match: RegExpMatchArray) => string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const CALLOUTS: Record<string, string> = {
|
|
11
|
-
note: '<Note>',
|
|
12
|
-
info: '<Info>',
|
|
13
|
-
tip: '<Tip>',
|
|
14
|
-
hint: '<Tip>',
|
|
15
|
-
success: '<Check>',
|
|
16
|
-
important: '<Note>',
|
|
17
|
-
warning: '<Warning>',
|
|
18
|
-
caution: '<Warning>',
|
|
19
|
-
danger: '<Warning>',
|
|
20
|
-
error: '<Warning>',
|
|
21
|
-
details: '<Accordion>',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const callout = (name: string | undefined) =>
|
|
25
|
-
CALLOUTS[name?.toLowerCase() ?? ''] ?? 'a callout (<Note>, <Info>, <Tip> or <Warning>)';
|
|
26
|
-
|
|
27
|
-
const LIQUID_TAGS: Record<string, string> = {
|
|
28
|
-
hint: 'a callout (<Note>, <Info>, <Tip> or <Warning>)',
|
|
29
|
-
tabs: '<Tabs>',
|
|
30
|
-
tab: '<Tab title="…">',
|
|
31
|
-
stepper: '<Steps>',
|
|
32
|
-
step: '<Step title="…">',
|
|
33
|
-
embed: 'a link or <Frame>',
|
|
34
|
-
'content-ref': '<Card>',
|
|
35
|
-
include: 'a snippet import',
|
|
36
|
-
code: 'a fenced code block',
|
|
37
|
-
file: 'a link to the file',
|
|
38
|
-
swagger: 'an OpenAPI page',
|
|
39
|
-
openapi: 'an OpenAPI page',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const PATTERNS: Pattern[] = [
|
|
43
|
-
{
|
|
44
|
-
regex: /\{%-?\s*(?!end)([\w-]+)[^%\n]*?-?%\}/g,
|
|
45
|
-
message: ([tag, name]) => {
|
|
46
|
-
const style = name === 'hint' ? /style=["']?(\w+)/.exec(tag)?.[1] : undefined;
|
|
47
|
-
const target = style
|
|
48
|
-
? callout(style)
|
|
49
|
-
: (LIQUID_TAGS[name ?? ''] ?? 'Markdown or a Mintlify component');
|
|
50
|
-
return `${tag} is a GitBook or Liquid tag, which Mintlify does not support; use ${target}`;
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
regex: /\{\{[<%]\s*([\w/-]+)[^}\n]*[>%]\}\}/g,
|
|
55
|
-
message: ([tag]) =>
|
|
56
|
-
`${tag} is a Hugo shortcode, which Mintlify does not support; use Markdown or a Mintlify component`,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
regex:
|
|
60
|
-
/\{\{-?\s*(?:(?:site|page|layout|include|jekyll|paginator)\.[^}\n]*|[^\s|{}]+\s*\|\s*\w+[^}\n]*)-?\}\}/g,
|
|
61
|
-
message: ([tag]) =>
|
|
62
|
-
`${tag} is a Liquid variable, which Mintlify does not support; write the value, or use a snippet or a variable`,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
regex: /^ {0,3}:{3,}\s*([A-Za-z][\w-]*)/gm,
|
|
66
|
-
message: ([, name]) =>
|
|
67
|
-
`:::${name} is a Docusaurus or VitePress admonition, which Mintlify does not support; use ${callout(name)}`,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
regex: /^ {0,3}::(?!:)([A-Za-z][\w-]*)/gm,
|
|
71
|
-
message: ([, name]) =>
|
|
72
|
-
`::${name} is an MDC (Nuxt Content, Docus) block, which Mintlify does not support; use the matching Mintlify component`,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
regex: /^ {0,3}(!!!|\?\?\?\+?)[ \t]+([A-Za-z][\w-]*)/gm,
|
|
76
|
-
message: ([, marker, name]) =>
|
|
77
|
-
`${marker} ${name} is an MkDocs admonition, which Mintlify does not support; use ${
|
|
78
|
-
marker === '!!!' ? callout(name) : '<Accordion>'
|
|
79
|
-
}`,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
regex: /^ {0,3}===\+?[ \t]+["']/gm,
|
|
83
|
-
message: () =>
|
|
84
|
-
`=== "…" is an MkDocs content tab, which Mintlify does not support; use <Tabs> with <Tab title="…">`,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
regex: /^[ \t]*;?[ \t]*--8<--/gm,
|
|
88
|
-
scope: 'everything',
|
|
89
|
-
message: () =>
|
|
90
|
-
'--8<-- is an MkDocs snippet include, which Mintlify does not support; use a snippet import or paste the content',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
regex: /\{:\s*[.#\w][^}\n]*\}/g,
|
|
94
|
-
message: ([list]) =>
|
|
95
|
-
`${list} is a Kramdown attribute list, which Mintlify does not support; remove it, use a component, or use {#id} for a heading anchor`,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
regex: /(?<![[{\w])\[\[([^[\]\n]+)\]\](?![(:[])/g,
|
|
99
|
-
message: ([link]) =>
|
|
100
|
-
`${link} is a wiki link, which Mintlify does not support; use a Markdown link such as [text](/path)`,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
regex: /(?:\]\(|href=["'])((?:doc|ref|blog|changelog|page):[^)\s"']+)/g,
|
|
104
|
-
scope: 'links',
|
|
105
|
-
message: ([, link]) =>
|
|
106
|
-
`${link} is a ReadMe link, which Mintlify does not support; link to the page path instead, such as /${
|
|
107
|
-
link?.split(':')[1] ?? ''
|
|
108
|
-
}`,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
regex: /["'(]@site\/[^"')\s]*/g,
|
|
112
|
-
scope: 'prose-and-esm',
|
|
113
|
-
message: ([path]) =>
|
|
114
|
-
`${path.slice(1)} uses the Docusaurus @site alias, which Mintlify does not resolve; use a root-relative path such as /images/… or /snippets/…`,
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
export const foreignSyntax: FileRule = {
|
|
119
|
-
id: 'foreign-syntax',
|
|
120
|
-
group: 'content',
|
|
121
|
-
severity: 'warning',
|
|
122
|
-
scope: 'file',
|
|
123
|
-
description: "syntax from another docs framework that Mintlify doesn't render",
|
|
124
|
-
raw: true,
|
|
125
|
-
check: ({ content }) => {
|
|
126
|
-
const prose = maskCode(content);
|
|
127
|
-
const literal = maskNonMarkup(content);
|
|
128
|
-
const views = {
|
|
129
|
-
prose,
|
|
130
|
-
links: prose,
|
|
131
|
-
'prose-and-esm': maskCode(content, { keepEsm: true }),
|
|
132
|
-
everything: maskFrontmatter(content),
|
|
133
|
-
};
|
|
134
|
-
const issues: FileFinding[] = [];
|
|
135
|
-
for (const { regex, scope = 'prose', message } of PATTERNS) {
|
|
136
|
-
for (const match of views[scope].matchAll(regex)) {
|
|
137
|
-
const start = match.index + (match[0].length - match[0].trimStart().length);
|
|
138
|
-
if (scope === 'prose' && literal[start] !== prose[start]) continue;
|
|
139
|
-
issues.push({ ...toPosition(content, start), message: message(match) });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return issues;
|
|
143
|
-
},
|
|
144
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { isCurrencyMath } from '@mintlify/common';
|
|
2
|
-
import katex from 'katex';
|
|
3
|
-
import { visit } from 'unist-util-visit';
|
|
4
|
-
|
|
5
|
-
import type { FileRule, FileFinding } from '../../types.js';
|
|
6
|
-
|
|
7
|
-
export const katexRule: FileRule = {
|
|
8
|
-
id: 'katex',
|
|
9
|
-
group: 'content',
|
|
10
|
-
severity: 'warning',
|
|
11
|
-
scope: 'file',
|
|
12
|
-
description: "math that KaTeX can't render",
|
|
13
|
-
check: ({ tree, content }) => {
|
|
14
|
-
const issues: FileFinding[] = [];
|
|
15
|
-
visit(tree, (node) => {
|
|
16
|
-
if (node.type !== 'math' && node.type !== 'inlineMath') return;
|
|
17
|
-
if (node.type === 'inlineMath' && isCurrencyMath(node, content)) return;
|
|
18
|
-
try {
|
|
19
|
-
katex.renderToString(node.value, {
|
|
20
|
-
throwOnError: true,
|
|
21
|
-
displayMode: node.type === 'math',
|
|
22
|
-
});
|
|
23
|
-
} catch (error) {
|
|
24
|
-
issues.push({
|
|
25
|
-
line: node.position?.start.line,
|
|
26
|
-
column: node.position?.start.column,
|
|
27
|
-
message: error instanceof Error ? error.message : 'invalid math',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return issues;
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { replaceVariables } from '@mintlify/common';
|
|
2
|
-
import { visit } from 'unist-util-visit';
|
|
3
|
-
|
|
4
|
-
import type { FileFinding, FileRule } from '../../types.js';
|
|
5
|
-
|
|
6
|
-
const exists = (file: string, readFile: (file: string) => string | undefined) =>
|
|
7
|
-
!file.startsWith('/') &&
|
|
8
|
-
(readFile(`_snippets/${file}`) !== undefined ||
|
|
9
|
-
(file.startsWith('snippets/') && readFile(file) !== undefined));
|
|
10
|
-
|
|
11
|
-
export const missingSnippet: FileRule = {
|
|
12
|
-
id: 'missing-snippet',
|
|
13
|
-
group: 'content',
|
|
14
|
-
severity: 'error',
|
|
15
|
-
scope: 'file',
|
|
16
|
-
description: '<Snippet file> tags whose file the build cannot find',
|
|
17
|
-
check: ({ tree, readFile, variables }) => {
|
|
18
|
-
if (!readFile) return [];
|
|
19
|
-
const issues: FileFinding[] = [];
|
|
20
|
-
visit(tree, 'mdxJsxFlowElement', (node) => {
|
|
21
|
-
if (node.name !== 'Snippet') return;
|
|
22
|
-
const value = node.attributes.find(
|
|
23
|
-
(attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'file'
|
|
24
|
-
)?.value;
|
|
25
|
-
if (typeof value !== 'string') return;
|
|
26
|
-
const file = replaceVariables(value, variables);
|
|
27
|
-
if (exists(file, readFile)) return;
|
|
28
|
-
issues.push({
|
|
29
|
-
line: node.position?.start.line,
|
|
30
|
-
column: node.position?.start.column,
|
|
31
|
-
message: `<Snippet file="${value}"> renders nothing: no snippet matches "${file}"`,
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
return issues;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { maskCode, toPosition } from '../../mdx.js';
|
|
2
|
-
import type { FileRule } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
const VARIABLE = /(?<!=\s*)\{\{\s*([\w.\-]+)\s*\}\}/g;
|
|
5
|
-
|
|
6
|
-
export const undefinedVariable: FileRule = {
|
|
7
|
-
id: 'undefined-variable',
|
|
8
|
-
group: 'content',
|
|
9
|
-
severity: 'error',
|
|
10
|
-
scope: 'file',
|
|
11
|
-
description: '{{variables}} that docs.json does not define',
|
|
12
|
-
raw: true,
|
|
13
|
-
check: ({ content, variables = {} }) =>
|
|
14
|
-
[...maskCode(content).matchAll(VARIABLE)]
|
|
15
|
-
.filter(([, name]) => name !== undefined && variables[name] === undefined)
|
|
16
|
-
.map((match) => ({
|
|
17
|
-
...toPosition(content, match.index),
|
|
18
|
-
message: `{{${match[1]}}} is not defined in the variables of docs.json`,
|
|
19
|
-
})),
|
|
20
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
collectPatternNames,
|
|
3
|
-
collectExportedNames,
|
|
4
|
-
getAST,
|
|
5
|
-
isBuiltInComponent,
|
|
6
|
-
JSX_EXTENSIONS,
|
|
7
|
-
visitReferences,
|
|
8
|
-
} from '@mintlify/common';
|
|
9
|
-
import { visit } from 'unist-util-visit';
|
|
10
|
-
|
|
11
|
-
import type { FileContext, FileRule, FileFinding } from '../../types.js';
|
|
12
|
-
|
|
13
|
-
const getDeclared = (context: FileContext): Set<string> => {
|
|
14
|
-
const declared = new Set<string>();
|
|
15
|
-
visit(context.tree, 'mdxjsEsm', (node) => {
|
|
16
|
-
for (const statement of node.data?.estree?.body ?? []) {
|
|
17
|
-
if (statement.type === 'ImportDeclaration') {
|
|
18
|
-
for (const specifier of statement.specifiers) {
|
|
19
|
-
collectPatternNames(specifier.local, declared);
|
|
20
|
-
}
|
|
21
|
-
} else if (statement.type === 'ExportNamedDeclaration') {
|
|
22
|
-
const declaration = statement.declaration;
|
|
23
|
-
if (declaration?.type === 'VariableDeclaration') {
|
|
24
|
-
for (const declarator of declaration.declarations) {
|
|
25
|
-
collectPatternNames(declarator.id, declared);
|
|
26
|
-
}
|
|
27
|
-
} else if (declaration) {
|
|
28
|
-
collectPatternNames(declaration.id, declared);
|
|
29
|
-
}
|
|
30
|
-
for (const specifier of statement.specifiers) {
|
|
31
|
-
collectPatternNames(specifier.local, declared);
|
|
32
|
-
collectPatternNames(specifier.exported, declared);
|
|
33
|
-
}
|
|
34
|
-
} else if (statement.type === 'ExportDefaultDeclaration') {
|
|
35
|
-
const declaration = statement.declaration;
|
|
36
|
-
if (declaration.type === 'FunctionDeclaration' || declaration.type === 'ClassDeclaration') {
|
|
37
|
-
collectPatternNames(declaration.id, declared);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return declared;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const getImportPosition = (context: FileContext): number => {
|
|
46
|
-
const frontmatter = context.tree.children.find((child) => ['yaml', 'toml'].includes(child.type));
|
|
47
|
-
return frontmatter?.position?.end.offset ?? 0;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const getSpecifier = (snippet: string, file: string, name: string): string | undefined => {
|
|
51
|
-
let exported: Set<string>;
|
|
52
|
-
try {
|
|
53
|
-
exported = collectExportedNames(getAST(snippet, file));
|
|
54
|
-
} catch {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
if (exported.has(name)) return `{ ${name} }`;
|
|
58
|
-
return exported.has('default') ? name : undefined;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const unknownComponent: FileRule = {
|
|
62
|
-
id: 'unknown-component',
|
|
63
|
-
group: 'content',
|
|
64
|
-
severity: 'error',
|
|
65
|
-
scope: 'file',
|
|
66
|
-
description: 'JSX components that are not built in, imported or exported',
|
|
67
|
-
pagesOnly: true,
|
|
68
|
-
check: (context) => {
|
|
69
|
-
const declared = getDeclared(context);
|
|
70
|
-
const reported = new Set<string>();
|
|
71
|
-
const issues: FileFinding[] = [];
|
|
72
|
-
const insertAt = getImportPosition(context);
|
|
73
|
-
const prefix = insertAt === 0 ? '' : '\n\n';
|
|
74
|
-
const following = /^\n*/.exec(context.content.slice(insertAt))?.[0].length ?? 0;
|
|
75
|
-
const suffix = '\n'.repeat(Math.max(0, 2 - following));
|
|
76
|
-
|
|
77
|
-
const check = (
|
|
78
|
-
tag: string | null | undefined,
|
|
79
|
-
position: { line?: number; column?: number } | undefined
|
|
80
|
-
) => {
|
|
81
|
-
const name = tag?.split('.')[0];
|
|
82
|
-
if (!tag || !name || !/^[A-Z]/.test(name)) return;
|
|
83
|
-
if (declared.has(name) || reported.has(tag) || isBuiltInComponent(tag)) return;
|
|
84
|
-
reported.add(tag);
|
|
85
|
-
|
|
86
|
-
const file = JSX_EXTENSIONS.map((extension) => `snippets/${name}${extension}`).find(
|
|
87
|
-
(candidate) => context.readFile?.(candidate) !== undefined
|
|
88
|
-
);
|
|
89
|
-
const source = file && context.readFile?.(file);
|
|
90
|
-
const specifier =
|
|
91
|
-
file && source !== undefined && tag === name ? getSpecifier(source, file, name) : undefined;
|
|
92
|
-
issues.push({
|
|
93
|
-
line: position?.line,
|
|
94
|
-
column: position?.column,
|
|
95
|
-
message: `<${tag}> is not built in, imported or exported on this page`,
|
|
96
|
-
edit: specifier
|
|
97
|
-
? {
|
|
98
|
-
start: insertAt,
|
|
99
|
-
end: insertAt,
|
|
100
|
-
text: `${prefix}import ${specifier} from "/${file}";${suffix}`,
|
|
101
|
-
}
|
|
102
|
-
: undefined,
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const checkJsxInExpression = (estree: unknown, fallback?: { line?: number; column?: number }) =>
|
|
107
|
-
visitReferences(estree, new Set(), {
|
|
108
|
-
reference: (identifier) => {
|
|
109
|
-
if (identifier.type !== 'JSXIdentifier') return;
|
|
110
|
-
const loc = identifier.loc as { start?: { line: number; column: number } } | undefined;
|
|
111
|
-
check(String(identifier.name), loc?.start ?? fallback);
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
visit(context.tree, (node) => {
|
|
116
|
-
if (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') {
|
|
117
|
-
check(node.name, node.position?.start);
|
|
118
|
-
for (const attribute of node.attributes) {
|
|
119
|
-
const value = attribute.type === 'mdxJsxAttribute' ? attribute.value : attribute;
|
|
120
|
-
if (value && typeof value === 'object') {
|
|
121
|
-
checkJsxInExpression(value.data?.estree, node.position?.start);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
} else if (node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression') {
|
|
125
|
-
checkJsxInExpression(node.data?.estree, node.position?.start);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return issues;
|
|
129
|
-
},
|
|
130
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { htmlVoidElements } from 'html-void-elements';
|
|
2
|
-
|
|
3
|
-
import { maskNonMarkup } from '../../mdx.js';
|
|
4
|
-
import type { FileRule, FileFinding } from '../../types.js';
|
|
5
|
-
|
|
6
|
-
const VOID_TAG_NAMES = htmlVoidElements.filter((tag) => tag !== 'image');
|
|
7
|
-
const ATTRIBUTE = String.raw`"[^"]*"|'[^']*'|\{[^{}]*\}|[^<>"'{}]`;
|
|
8
|
-
const VOID_TAG = new RegExp(
|
|
9
|
-
String.raw`<(${VOID_TAG_NAMES.join('|')})(?=[\s/>])(?:${ATTRIBUTE})*?(\/?)>`,
|
|
10
|
-
'g'
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const voidTags: FileRule = {
|
|
14
|
-
id: 'void-tags',
|
|
15
|
-
group: 'content',
|
|
16
|
-
severity: 'error',
|
|
17
|
-
scope: 'file',
|
|
18
|
-
description:
|
|
19
|
-
"self-close void HTML tags (<br>, <img>, <source>, …); MDX can't parse them unclosed",
|
|
20
|
-
raw: true,
|
|
21
|
-
check: ({ content }) => {
|
|
22
|
-
const masked = maskNonMarkup(content);
|
|
23
|
-
const issues: FileFinding[] = [];
|
|
24
|
-
for (const match of masked.matchAll(VOID_TAG)) {
|
|
25
|
-
if (match[2]) continue;
|
|
26
|
-
const start = match.index;
|
|
27
|
-
const end = start + match[0].length;
|
|
28
|
-
if (new RegExp(`^\\s*</${match[1]}\\s*>`).test(masked.slice(end))) continue;
|
|
29
|
-
const before = content.slice(0, start).split('\n');
|
|
30
|
-
issues.push({
|
|
31
|
-
line: before.length,
|
|
32
|
-
column: (before.pop()?.length ?? 0) + 1,
|
|
33
|
-
message: `<${match[1]}> must be self-closed`,
|
|
34
|
-
edit: {
|
|
35
|
-
start,
|
|
36
|
-
end,
|
|
37
|
-
text: `${content.slice(start, end - 1).trimEnd()} />`,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return issues;
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Rule } from '../types.js';
|
|
2
|
-
import { BUILD_RULES } from './build.js';
|
|
3
|
-
import { duplicateH1 } from './content/duplicateH1.js';
|
|
4
|
-
import { foreignSyntax } from './content/foreignSyntax.js';
|
|
5
|
-
import { katexRule } from './content/katex.js';
|
|
6
|
-
import { missingSnippet } from './content/missingSnippet.js';
|
|
7
|
-
import { undefinedVariable } from './content/undefinedVariable.js';
|
|
8
|
-
import { unknownComponent } from './content/unknownComponent.js';
|
|
9
|
-
import { voidTags } from './content/voidTags.js';
|
|
10
|
-
import { openApiSpec } from './openapi.js';
|
|
11
|
-
|
|
12
|
-
/** Every check mint validate runs, in report order. */
|
|
13
|
-
export const RULES: Rule[] = [
|
|
14
|
-
voidTags,
|
|
15
|
-
duplicateH1,
|
|
16
|
-
unknownComponent,
|
|
17
|
-
undefinedVariable,
|
|
18
|
-
missingSnippet,
|
|
19
|
-
katexRule,
|
|
20
|
-
foreignSyntax,
|
|
21
|
-
openApiSpec,
|
|
22
|
-
...BUILD_RULES,
|
|
23
|
-
];
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { errorMessage } from '../../helpers.js';
|
|
5
|
-
import {
|
|
6
|
-
buildOverlayRegistryForCheck,
|
|
7
|
-
checkOpenApiFile,
|
|
8
|
-
getOpenApiFilenamesFromDocsConfig,
|
|
9
|
-
type OpenApiCheckMessage,
|
|
10
|
-
} from '../../openApiCheck.js';
|
|
11
|
-
import type { Finding, SiteRule } from '../types.js';
|
|
12
|
-
|
|
13
|
-
export const openApiSpec: SiteRule = {
|
|
14
|
-
id: 'openapi-spec',
|
|
15
|
-
group: 'openapi',
|
|
16
|
-
severity: 'error',
|
|
17
|
-
scope: 'site',
|
|
18
|
-
description:
|
|
19
|
-
"OpenAPI specs in docs.json or mint.json that don't parse or validate, with overlays applied",
|
|
20
|
-
check: async (site) => {
|
|
21
|
-
let filenames: string[] = [];
|
|
22
|
-
try {
|
|
23
|
-
const config = JSON.parse(
|
|
24
|
-
await fs.readFile(path.join(site.baseDir, site.configFile), 'utf-8')
|
|
25
|
-
);
|
|
26
|
-
// mint.json lists its specs under a top-level openapi key
|
|
27
|
-
filenames = getOpenApiFilenamesFromDocsConfig(
|
|
28
|
-
site.configFile === 'mint.json' ? { api: { openapi: config.openapi } } : config
|
|
29
|
-
);
|
|
30
|
-
} catch {
|
|
31
|
-
// A missing or invalid config file is the build's to report
|
|
32
|
-
}
|
|
33
|
-
if (filenames.length === 0) return [];
|
|
34
|
-
|
|
35
|
-
let overlayRegistry;
|
|
36
|
-
try {
|
|
37
|
-
overlayRegistry = await buildOverlayRegistryForCheck(site.localSchema);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
return [{ file: site.configFile, message: `OpenAPI overlays: ${errorMessage(error)}` }];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const perFile = await Promise.all(
|
|
43
|
-
filenames.map(async (file) => {
|
|
44
|
-
const messages: OpenApiCheckMessage[] = [];
|
|
45
|
-
await checkOpenApiFile(file, site.localSchema, overlayRegistry, (message) =>
|
|
46
|
-
messages.push(message)
|
|
47
|
-
);
|
|
48
|
-
return messages.flatMap(({ level, message }): Finding[] =>
|
|
49
|
-
level === 'error'
|
|
50
|
-
? [{ file, message }]
|
|
51
|
-
: level === 'warning'
|
|
52
|
-
? [{ file, message, severity: 'warning' }]
|
|
53
|
-
: []
|
|
54
|
-
);
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
return perFile.flat();
|
|
58
|
-
},
|
|
59
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DiagnosticSource } from '../types.js';
|
|
2
|
-
|
|
3
|
-
/** The engine's built-in diagnostic for files neither parser can parse; not a selectable rule. */
|
|
4
|
-
export const PARSE_ERROR: DiagnosticSource = {
|
|
5
|
-
id: 'parse-error',
|
|
6
|
-
group: 'content',
|
|
7
|
-
severity: 'error',
|
|
8
|
-
description: "files MDX can't parse; other checks skip them",
|
|
9
|
-
};
|
package/src/validate/site.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { readSiteFiles } from './files.js';
|
|
5
|
-
import { toPosition } from './mdx.js';
|
|
6
|
-
import type { Site } from './types.js';
|
|
7
|
-
|
|
8
|
-
const readVariables = (config: string): Record<string, string> | undefined => {
|
|
9
|
-
try {
|
|
10
|
-
const { variables } = JSON.parse(config) as { variables?: unknown };
|
|
11
|
-
return variables && typeof variables === 'object'
|
|
12
|
-
? (variables as Record<string, string>)
|
|
13
|
-
: undefined;
|
|
14
|
-
} catch {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/** Lists the site's pages and snippets; locate reads files from disk on demand. */
|
|
20
|
-
export const loadSite = async (
|
|
21
|
-
baseDir: string,
|
|
22
|
-
{ selected, localSchema }: { selected?: ReadonlySet<string>; localSchema: boolean }
|
|
23
|
-
): Promise<Site> => {
|
|
24
|
-
const files = await readSiteFiles(baseDir);
|
|
25
|
-
const byPath = new Map<string, string | undefined>();
|
|
26
|
-
const configFile = fs.existsSync(path.join(baseDir, 'docs.json')) ? 'docs.json' : 'mint.json';
|
|
27
|
-
|
|
28
|
-
const read = (file: string) => {
|
|
29
|
-
if (!byPath.has(file)) {
|
|
30
|
-
try {
|
|
31
|
-
byPath.set(file, fs.readFileSync(path.join(baseDir, file), 'utf-8'));
|
|
32
|
-
} catch {
|
|
33
|
-
byPath.set(file, undefined);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return byPath.get(file);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
baseDir,
|
|
41
|
-
files,
|
|
42
|
-
selected,
|
|
43
|
-
configFile,
|
|
44
|
-
variables: readVariables(read(configFile) ?? ''),
|
|
45
|
-
localSchema,
|
|
46
|
-
read,
|
|
47
|
-
locate: (file, text) => {
|
|
48
|
-
const content = read(file) ?? '';
|
|
49
|
-
const offset = text ? content.indexOf(text) : -1;
|
|
50
|
-
return offset === -1 ? {} : toPosition(content, offset);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
};
|
package/src/validate/types.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { BuildValidationResult } from '@mintlify/previewing';
|
|
2
|
-
import type { Root } from 'mdast';
|
|
3
|
-
|
|
4
|
-
export type Group = 'content' | 'nav' | 'config' | 'openapi';
|
|
5
|
-
|
|
6
|
-
export const GROUPS: Group[] = ['content', 'nav', 'config', 'openapi'];
|
|
7
|
-
|
|
8
|
-
export type Severity = 'error' | 'warning';
|
|
9
|
-
|
|
10
|
-
export type Edit = { start: number; end: number; text: string };
|
|
11
|
-
|
|
12
|
-
export type FileEdit = Edit & { file: string };
|
|
13
|
-
|
|
14
|
-
/** A fix --fix applied: where it was and the text it replaced. */
|
|
15
|
-
export type Change = {
|
|
16
|
-
rule: string;
|
|
17
|
-
file: string;
|
|
18
|
-
line?: number;
|
|
19
|
-
column?: number;
|
|
20
|
-
before: string;
|
|
21
|
-
after: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type Diagnostic = {
|
|
25
|
-
rule: string;
|
|
26
|
-
group: Group;
|
|
27
|
-
severity: Severity;
|
|
28
|
-
file: string;
|
|
29
|
-
line?: number;
|
|
30
|
-
column?: number;
|
|
31
|
-
message: string;
|
|
32
|
-
fix?: FileEdit;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/** What a rule reports; the engine adds its id and group, and its severity unless overridden. */
|
|
36
|
-
export type Finding = Omit<Diagnostic, 'rule' | 'group' | 'severity'> & { severity?: Severity };
|
|
37
|
-
|
|
38
|
-
type RuleMeta = {
|
|
39
|
-
id: string;
|
|
40
|
-
group: Group;
|
|
41
|
-
severity: Severity;
|
|
42
|
-
needsBuild?: boolean;
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type DiagnosticSource = Pick<RuleMeta, 'id' | 'group' | 'severity' | 'description'>;
|
|
47
|
-
|
|
48
|
-
export type FileKind = 'page' | 'snippet';
|
|
49
|
-
|
|
50
|
-
export type FileContext = {
|
|
51
|
-
file: string;
|
|
52
|
-
content: string;
|
|
53
|
-
baseDir: string;
|
|
54
|
-
frontmatter: Record<string, unknown>;
|
|
55
|
-
tree: Root;
|
|
56
|
-
readFile?: (file: string) => string | undefined;
|
|
57
|
-
anchorLinks?: ReadonlySet<string>;
|
|
58
|
-
variables?: Record<string, string>;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/** A finding in one file, with an optional edit against the content the rule saw. */
|
|
62
|
-
export type FileFinding = {
|
|
63
|
-
line?: number;
|
|
64
|
-
column?: number;
|
|
65
|
-
message: string;
|
|
66
|
-
edit?: Edit;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/** Checks one page or snippet at a time. Raw rules read text; the rest also get the MDX tree. */
|
|
70
|
-
export type FileRule = RuleMeta & {
|
|
71
|
-
scope: 'file';
|
|
72
|
-
raw?: boolean;
|
|
73
|
-
pagesOnly?: boolean;
|
|
74
|
-
needsAnchorLinks?: boolean;
|
|
75
|
-
check: (context: FileContext) => FileFinding[];
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export type SiteFile = { file: string; kind: FileKind };
|
|
79
|
-
|
|
80
|
-
export type BuildResult = BuildValidationResult;
|
|
81
|
-
|
|
82
|
-
export type Site = {
|
|
83
|
-
baseDir: string;
|
|
84
|
-
files: SiteFile[];
|
|
85
|
-
/** Set with --files: rules report on these files only. */
|
|
86
|
-
selected?: ReadonlySet<string>;
|
|
87
|
-
configFile: string;
|
|
88
|
-
variables?: Record<string, string>;
|
|
89
|
-
build?: BuildResult;
|
|
90
|
-
/** The line and column of the first occurrence of text in a file. */
|
|
91
|
-
locate: (file: string, text: string) => { line?: number; column?: number };
|
|
92
|
-
read: (file: string) => string | undefined;
|
|
93
|
-
localSchema: boolean;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/** Checks the site as a whole. */
|
|
97
|
-
export type SiteRule = RuleMeta & {
|
|
98
|
-
scope: 'site';
|
|
99
|
-
check: (site: Site) => Finding[] | Promise<Finding[]>;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type Rule = FileRule | SiteRule;
|
package/src/vendor/converter.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@mintlify/editor/converter';
|