@mintlify/cli 4.0.1813 → 4.1.2
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 +38 -31
- 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,121 +0,0 @@
|
|
|
1
|
-
import { collectPatternNames, collectExportedNames, getAST, isBuiltInComponent, JSX_EXTENSIONS, visitReferences, } from '@mintlify/common';
|
|
2
|
-
import { visit } from 'unist-util-visit';
|
|
3
|
-
const getDeclared = (context) => {
|
|
4
|
-
const declared = new Set();
|
|
5
|
-
visit(context.tree, 'mdxjsEsm', (node) => {
|
|
6
|
-
var _a, _b, _c;
|
|
7
|
-
for (const statement of (_c = (_b = (_a = node.data) === null || _a === void 0 ? void 0 : _a.estree) === null || _b === void 0 ? void 0 : _b.body) !== null && _c !== void 0 ? _c : []) {
|
|
8
|
-
if (statement.type === 'ImportDeclaration') {
|
|
9
|
-
for (const specifier of statement.specifiers) {
|
|
10
|
-
collectPatternNames(specifier.local, declared);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
else if (statement.type === 'ExportNamedDeclaration') {
|
|
14
|
-
const declaration = statement.declaration;
|
|
15
|
-
if ((declaration === null || declaration === void 0 ? void 0 : declaration.type) === 'VariableDeclaration') {
|
|
16
|
-
for (const declarator of declaration.declarations) {
|
|
17
|
-
collectPatternNames(declarator.id, declared);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (declaration) {
|
|
21
|
-
collectPatternNames(declaration.id, declared);
|
|
22
|
-
}
|
|
23
|
-
for (const specifier of statement.specifiers) {
|
|
24
|
-
collectPatternNames(specifier.local, declared);
|
|
25
|
-
collectPatternNames(specifier.exported, declared);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else if (statement.type === 'ExportDefaultDeclaration') {
|
|
29
|
-
const declaration = statement.declaration;
|
|
30
|
-
if (declaration.type === 'FunctionDeclaration' || declaration.type === 'ClassDeclaration') {
|
|
31
|
-
collectPatternNames(declaration.id, declared);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return declared;
|
|
37
|
-
};
|
|
38
|
-
const getImportPosition = (context) => {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
const frontmatter = context.tree.children.find((child) => ['yaml', 'toml'].includes(child.type));
|
|
41
|
-
return (_b = (_a = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.position) === null || _a === void 0 ? void 0 : _a.end.offset) !== null && _b !== void 0 ? _b : 0;
|
|
42
|
-
};
|
|
43
|
-
const getSpecifier = (snippet, file, name) => {
|
|
44
|
-
let exported;
|
|
45
|
-
try {
|
|
46
|
-
exported = collectExportedNames(getAST(snippet, file));
|
|
47
|
-
}
|
|
48
|
-
catch (_a) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
if (exported.has(name))
|
|
52
|
-
return `{ ${name} }`;
|
|
53
|
-
return exported.has('default') ? name : undefined;
|
|
54
|
-
};
|
|
55
|
-
export const unknownComponent = {
|
|
56
|
-
id: 'unknown-component',
|
|
57
|
-
group: 'content',
|
|
58
|
-
severity: 'error',
|
|
59
|
-
scope: 'file',
|
|
60
|
-
description: 'JSX components that are not built in, imported or exported',
|
|
61
|
-
pagesOnly: true,
|
|
62
|
-
check: (context) => {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const declared = getDeclared(context);
|
|
65
|
-
const reported = new Set();
|
|
66
|
-
const issues = [];
|
|
67
|
-
const insertAt = getImportPosition(context);
|
|
68
|
-
const prefix = insertAt === 0 ? '' : '\n\n';
|
|
69
|
-
const following = (_b = (_a = /^\n*/.exec(context.content.slice(insertAt))) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
70
|
-
const suffix = '\n'.repeat(Math.max(0, 2 - following));
|
|
71
|
-
const check = (tag, position) => {
|
|
72
|
-
var _a;
|
|
73
|
-
const name = tag === null || tag === void 0 ? void 0 : tag.split('.')[0];
|
|
74
|
-
if (!tag || !name || !/^[A-Z]/.test(name))
|
|
75
|
-
return;
|
|
76
|
-
if (declared.has(name) || reported.has(tag) || isBuiltInComponent(tag))
|
|
77
|
-
return;
|
|
78
|
-
reported.add(tag);
|
|
79
|
-
const file = JSX_EXTENSIONS.map((extension) => `snippets/${name}${extension}`).find((candidate) => { var _a; return ((_a = context.readFile) === null || _a === void 0 ? void 0 : _a.call(context, candidate)) !== undefined; });
|
|
80
|
-
const source = file && ((_a = context.readFile) === null || _a === void 0 ? void 0 : _a.call(context, file));
|
|
81
|
-
const specifier = file && source !== undefined && tag === name ? getSpecifier(source, file, name) : undefined;
|
|
82
|
-
issues.push({
|
|
83
|
-
line: position === null || position === void 0 ? void 0 : position.line,
|
|
84
|
-
column: position === null || position === void 0 ? void 0 : position.column,
|
|
85
|
-
message: `<${tag}> is not built in, imported or exported on this page`,
|
|
86
|
-
edit: specifier
|
|
87
|
-
? {
|
|
88
|
-
start: insertAt,
|
|
89
|
-
end: insertAt,
|
|
90
|
-
text: `${prefix}import ${specifier} from "/${file}";${suffix}`,
|
|
91
|
-
}
|
|
92
|
-
: undefined,
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
const checkJsxInExpression = (estree, fallback) => visitReferences(estree, new Set(), {
|
|
96
|
-
reference: (identifier) => {
|
|
97
|
-
var _a;
|
|
98
|
-
if (identifier.type !== 'JSXIdentifier')
|
|
99
|
-
return;
|
|
100
|
-
const loc = identifier.loc;
|
|
101
|
-
check(String(identifier.name), (_a = loc === null || loc === void 0 ? void 0 : loc.start) !== null && _a !== void 0 ? _a : fallback);
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
visit(context.tree, (node) => {
|
|
105
|
-
var _a, _b, _c, _d, _e;
|
|
106
|
-
if (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') {
|
|
107
|
-
check(node.name, (_a = node.position) === null || _a === void 0 ? void 0 : _a.start);
|
|
108
|
-
for (const attribute of node.attributes) {
|
|
109
|
-
const value = attribute.type === 'mdxJsxAttribute' ? attribute.value : attribute;
|
|
110
|
-
if (value && typeof value === 'object') {
|
|
111
|
-
checkJsxInExpression((_b = value.data) === null || _b === void 0 ? void 0 : _b.estree, (_c = node.position) === null || _c === void 0 ? void 0 : _c.start);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression') {
|
|
116
|
-
checkJsxInExpression((_d = node.data) === null || _d === void 0 ? void 0 : _d.estree, (_e = node.position) === null || _e === void 0 ? void 0 : _e.start);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return issues;
|
|
120
|
-
},
|
|
121
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { htmlVoidElements } from 'html-void-elements';
|
|
2
|
-
import { maskNonMarkup } from '../../mdx.js';
|
|
3
|
-
const VOID_TAG_NAMES = htmlVoidElements.filter((tag) => tag !== 'image');
|
|
4
|
-
const ATTRIBUTE = String.raw `"[^"]*"|'[^']*'|\{[^{}]*\}|[^<>"'{}]`;
|
|
5
|
-
const VOID_TAG = new RegExp(String.raw `<(${VOID_TAG_NAMES.join('|')})(?=[\s/>])(?:${ATTRIBUTE})*?(\/?)>`, 'g');
|
|
6
|
-
export const voidTags = {
|
|
7
|
-
id: 'void-tags',
|
|
8
|
-
group: 'content',
|
|
9
|
-
severity: 'error',
|
|
10
|
-
scope: 'file',
|
|
11
|
-
description: "self-close void HTML tags (<br>, <img>, <source>, …); MDX can't parse them unclosed",
|
|
12
|
-
raw: true,
|
|
13
|
-
check: ({ content }) => {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const masked = maskNonMarkup(content);
|
|
16
|
-
const issues = [];
|
|
17
|
-
for (const match of masked.matchAll(VOID_TAG)) {
|
|
18
|
-
if (match[2])
|
|
19
|
-
continue;
|
|
20
|
-
const start = match.index;
|
|
21
|
-
const end = start + match[0].length;
|
|
22
|
-
if (new RegExp(`^\\s*</${match[1]}\\s*>`).test(masked.slice(end)))
|
|
23
|
-
continue;
|
|
24
|
-
const before = content.slice(0, start).split('\n');
|
|
25
|
-
issues.push({
|
|
26
|
-
line: before.length,
|
|
27
|
-
column: ((_b = (_a = before.pop()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + 1,
|
|
28
|
-
message: `<${match[1]}> must be self-closed`,
|
|
29
|
-
edit: {
|
|
30
|
-
start,
|
|
31
|
-
end,
|
|
32
|
-
text: `${content.slice(start, end - 1).trimEnd()} />`,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return issues;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BUILD_RULES } from './build.js';
|
|
2
|
-
import { duplicateH1 } from './content/duplicateH1.js';
|
|
3
|
-
import { foreignSyntax } from './content/foreignSyntax.js';
|
|
4
|
-
import { katexRule } from './content/katex.js';
|
|
5
|
-
import { missingSnippet } from './content/missingSnippet.js';
|
|
6
|
-
import { undefinedVariable } from './content/undefinedVariable.js';
|
|
7
|
-
import { unknownComponent } from './content/unknownComponent.js';
|
|
8
|
-
import { voidTags } from './content/voidTags.js';
|
|
9
|
-
import { openApiSpec } from './openapi.js';
|
|
10
|
-
/** Every check mint validate runs, in report order. */
|
|
11
|
-
export const RULES = [
|
|
12
|
-
voidTags,
|
|
13
|
-
duplicateH1,
|
|
14
|
-
unknownComponent,
|
|
15
|
-
undefinedVariable,
|
|
16
|
-
missingSnippet,
|
|
17
|
-
katexRule,
|
|
18
|
-
foreignSyntax,
|
|
19
|
-
openApiSpec,
|
|
20
|
-
...BUILD_RULES,
|
|
21
|
-
];
|
|
@@ -1,50 +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 fs from 'node:fs/promises';
|
|
11
|
-
import path from 'node:path';
|
|
12
|
-
import { errorMessage } from '../../helpers.js';
|
|
13
|
-
import { buildOverlayRegistryForCheck, checkOpenApiFile, getOpenApiFilenamesFromDocsConfig, } from '../../openApiCheck.js';
|
|
14
|
-
export const openApiSpec = {
|
|
15
|
-
id: 'openapi-spec',
|
|
16
|
-
group: 'openapi',
|
|
17
|
-
severity: 'error',
|
|
18
|
-
scope: 'site',
|
|
19
|
-
description: "OpenAPI specs in docs.json or mint.json that don't parse or validate, with overlays applied",
|
|
20
|
-
check: (site) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
let filenames = [];
|
|
22
|
-
try {
|
|
23
|
-
const config = JSON.parse(yield fs.readFile(path.join(site.baseDir, site.configFile), 'utf-8'));
|
|
24
|
-
// mint.json lists its specs under a top-level openapi key
|
|
25
|
-
filenames = getOpenApiFilenamesFromDocsConfig(site.configFile === 'mint.json' ? { api: { openapi: config.openapi } } : config);
|
|
26
|
-
}
|
|
27
|
-
catch (_a) {
|
|
28
|
-
// A missing or invalid config file is the build's to report
|
|
29
|
-
}
|
|
30
|
-
if (filenames.length === 0)
|
|
31
|
-
return [];
|
|
32
|
-
let overlayRegistry;
|
|
33
|
-
try {
|
|
34
|
-
overlayRegistry = yield buildOverlayRegistryForCheck(site.localSchema);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
return [{ file: site.configFile, message: `OpenAPI overlays: ${errorMessage(error)}` }];
|
|
38
|
-
}
|
|
39
|
-
const perFile = yield Promise.all(filenames.map((file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
const messages = [];
|
|
41
|
-
yield checkOpenApiFile(file, site.localSchema, overlayRegistry, (message) => messages.push(message));
|
|
42
|
-
return messages.flatMap(({ level, message }) => level === 'error'
|
|
43
|
-
? [{ file, message }]
|
|
44
|
-
: level === 'warning'
|
|
45
|
-
? [{ file, message, severity: 'warning' }]
|
|
46
|
-
: []);
|
|
47
|
-
})));
|
|
48
|
-
return perFile.flat();
|
|
49
|
-
}),
|
|
50
|
-
};
|
package/bin/validate/site.js
DELETED
|
@@ -1,57 +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 fs from 'node:fs';
|
|
11
|
-
import path from 'node:path';
|
|
12
|
-
import { readSiteFiles } from './files.js';
|
|
13
|
-
import { toPosition } from './mdx.js';
|
|
14
|
-
const readVariables = (config) => {
|
|
15
|
-
try {
|
|
16
|
-
const { variables } = JSON.parse(config);
|
|
17
|
-
return variables && typeof variables === 'object'
|
|
18
|
-
? variables
|
|
19
|
-
: undefined;
|
|
20
|
-
}
|
|
21
|
-
catch (_a) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/** Lists the site's pages and snippets; locate reads files from disk on demand. */
|
|
26
|
-
export const loadSite = (baseDir_1, _a) => __awaiter(void 0, [baseDir_1, _a], void 0, function* (baseDir, { selected, localSchema }) {
|
|
27
|
-
var _b;
|
|
28
|
-
const files = yield readSiteFiles(baseDir);
|
|
29
|
-
const byPath = new Map();
|
|
30
|
-
const configFile = fs.existsSync(path.join(baseDir, 'docs.json')) ? 'docs.json' : 'mint.json';
|
|
31
|
-
const read = (file) => {
|
|
32
|
-
if (!byPath.has(file)) {
|
|
33
|
-
try {
|
|
34
|
-
byPath.set(file, fs.readFileSync(path.join(baseDir, file), 'utf-8'));
|
|
35
|
-
}
|
|
36
|
-
catch (_a) {
|
|
37
|
-
byPath.set(file, undefined);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return byPath.get(file);
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
baseDir,
|
|
44
|
-
files,
|
|
45
|
-
selected,
|
|
46
|
-
configFile,
|
|
47
|
-
variables: readVariables((_b = read(configFile)) !== null && _b !== void 0 ? _b : ''),
|
|
48
|
-
localSchema,
|
|
49
|
-
read,
|
|
50
|
-
locate: (file, text) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const content = (_a = read(file)) !== null && _a !== void 0 ? _a : '';
|
|
53
|
-
const offset = text ? content.indexOf(text) : -1;
|
|
54
|
-
return offset === -1 ? {} : toPosition(content, offset);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
});
|
package/bin/validate/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const GROUPS = ['content', 'nav', 'config', 'openapi'];
|