@mintlify/scraping 4.0.227 → 4.0.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/openapi/common.d.ts +6 -1
- package/bin/openapi/common.js +19 -14
- package/bin/openapi/common.js.map +1 -1
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/openapi/common.ts +35 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/scraping",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.229",
|
|
4
4
|
"description": "Scrape documentation frameworks to Mintlify docs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"format:check": "prettier . --check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@mintlify/common": "1.0.
|
|
41
|
+
"@mintlify/common": "1.0.373",
|
|
42
42
|
"@mintlify/openapi-parser": "^0.0.7",
|
|
43
43
|
"fs-extra": "^11.1.1",
|
|
44
44
|
"hast-util-to-mdast": "^10.1.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@mintlify/models": "0.0.189",
|
|
62
62
|
"@mintlify/prettier-config": "1.0.4",
|
|
63
63
|
"@mintlify/ts-config": "2.0.2",
|
|
64
|
-
"@mintlify/validation": "0.1.
|
|
64
|
+
"@mintlify/validation": "0.1.360",
|
|
65
65
|
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
|
|
66
66
|
"@tsconfig/recommended": "1.x",
|
|
67
67
|
"@types/hast": "^3.0.4",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"typescript": "^5.5.3",
|
|
78
78
|
"vitest": "^2.0.4"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "212bec92baf66057a5539dd6c40509f003770159"
|
|
81
81
|
}
|
package/src/openapi/common.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
OperationObject,
|
|
4
4
|
optionallyAddLeadingSlash,
|
|
5
5
|
slugToTitle,
|
|
6
|
+
buildOpenApiMetaTag,
|
|
6
7
|
} from '@mintlify/common';
|
|
7
8
|
import type { DecoratedNavigationPage } from '@mintlify/models';
|
|
8
9
|
import { outputFile } from 'fs-extra';
|
|
@@ -47,13 +48,21 @@ export const getOpenApiDefinition = async (
|
|
|
47
48
|
return { document: pathOrDocumentOrUrl, isUrl };
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
export const createOpenApiFrontmatter = async (
|
|
51
|
-
filename
|
|
52
|
-
openApiMetaTag
|
|
53
|
-
version
|
|
54
|
-
|
|
51
|
+
export const createOpenApiFrontmatter = async ({
|
|
52
|
+
filename,
|
|
53
|
+
openApiMetaTag,
|
|
54
|
+
version,
|
|
55
|
+
deprecated,
|
|
56
|
+
}: {
|
|
57
|
+
filename: string;
|
|
58
|
+
openApiMetaTag: string;
|
|
59
|
+
version?: string;
|
|
60
|
+
deprecated?: boolean;
|
|
61
|
+
}) => {
|
|
55
62
|
const data = `---
|
|
56
|
-
openapi: ${openApiMetaTag}${version ? `\nversion: ${version}` : ''}
|
|
63
|
+
openapi: ${openApiMetaTag}${version ? `\nversion: ${version}` : ''}${
|
|
64
|
+
deprecated ? `\ndeprecated: ${deprecated}` : ''
|
|
65
|
+
}
|
|
57
66
|
---`;
|
|
58
67
|
|
|
59
68
|
await outputFile(filename, data);
|
|
@@ -89,22 +98,6 @@ const isExcludedOperation = (operation: MaybeOperationObjectWithExtensions) => {
|
|
|
89
98
|
return operation['x-excluded'];
|
|
90
99
|
};
|
|
91
100
|
|
|
92
|
-
const buildOpenApiMetaTag = ({
|
|
93
|
-
openApiFilePathFromRoot,
|
|
94
|
-
method,
|
|
95
|
-
path,
|
|
96
|
-
deprecated,
|
|
97
|
-
}: {
|
|
98
|
-
openApiFilePathFromRoot: string | undefined;
|
|
99
|
-
method: string;
|
|
100
|
-
path: string;
|
|
101
|
-
deprecated: boolean;
|
|
102
|
-
}): string => {
|
|
103
|
-
const filePath = openApiFilePathFromRoot ? `${openApiFilePathFromRoot} ` : '';
|
|
104
|
-
const label = deprecated ? ` deprecated` : '';
|
|
105
|
-
return `${filePath}${method} ${path}${label}`;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
101
|
export function processOpenApiPath<N, DN>(
|
|
109
102
|
path: string,
|
|
110
103
|
pathItemObject: OpenAPIV3.PathItemObject,
|
|
@@ -139,10 +132,9 @@ export function processOpenApiPath<N, DN>(
|
|
|
139
132
|
|
|
140
133
|
const filenameWithoutExtension = generateUniqueFilenameWithoutExtension(navGroup, base);
|
|
141
134
|
const openapiMetaTag = buildOpenApiMetaTag({
|
|
142
|
-
openApiFilePathFromRoot,
|
|
135
|
+
filePath: openApiFilePathFromRoot,
|
|
143
136
|
method,
|
|
144
137
|
path,
|
|
145
|
-
deprecated: operation?.deprecated ?? false,
|
|
146
138
|
});
|
|
147
139
|
const { title: titleTag, description } = getOpenApiTitleAndDescription(
|
|
148
140
|
[
|
|
@@ -161,6 +153,7 @@ export function processOpenApiPath<N, DN>(
|
|
|
161
153
|
href: resolve('/', filenameWithoutExtension),
|
|
162
154
|
title: titleTag ?? slugToTitle(filenameWithoutExtension),
|
|
163
155
|
description,
|
|
156
|
+
deprecated: operation?.deprecated,
|
|
164
157
|
version: options.version,
|
|
165
158
|
};
|
|
166
159
|
|
|
@@ -173,7 +166,14 @@ export function processOpenApiPath<N, DN>(
|
|
|
173
166
|
? join(options.outDirBasePath, `${filenameWithoutExtension}.mdx`)
|
|
174
167
|
: `${filenameWithoutExtension}.mdx`;
|
|
175
168
|
if (options.writeFiles && (!fse.pathExistsSync(targetPath) || options.overwrite)) {
|
|
176
|
-
writePromises.push(
|
|
169
|
+
writePromises.push(
|
|
170
|
+
createOpenApiFrontmatter({
|
|
171
|
+
filename: targetPath,
|
|
172
|
+
openApiMetaTag: openapiMetaTag,
|
|
173
|
+
version: options.version,
|
|
174
|
+
deprecated: operation?.deprecated,
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
});
|
|
@@ -214,10 +214,9 @@ export function processOpenApiWebhook<N, DN>(
|
|
|
214
214
|
const filenameWithoutExtension = generateUniqueFilenameWithoutExtension(navGroup, base);
|
|
215
215
|
|
|
216
216
|
const openapiMetaTag = buildOpenApiMetaTag({
|
|
217
|
-
openApiFilePathFromRoot,
|
|
217
|
+
filePath: openApiFilePathFromRoot,
|
|
218
218
|
method: 'webhook',
|
|
219
219
|
path: webhook,
|
|
220
|
-
deprecated: operation?.deprecated ?? false,
|
|
221
220
|
});
|
|
222
221
|
|
|
223
222
|
const description = operation?.description;
|
|
@@ -228,6 +227,7 @@ export function processOpenApiWebhook<N, DN>(
|
|
|
228
227
|
title: slugToTitle(filenameWithoutExtension),
|
|
229
228
|
description,
|
|
230
229
|
version: options.version,
|
|
230
|
+
deprecated: operation?.deprecated,
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
if (!isHiddenOperation(operation as MaybeOperationObjectWithExtensions)) {
|
|
@@ -239,7 +239,14 @@ export function processOpenApiWebhook<N, DN>(
|
|
|
239
239
|
? join(options.outDirBasePath, `${filenameWithoutExtension}.mdx`)
|
|
240
240
|
: `${filenameWithoutExtension}.mdx`;
|
|
241
241
|
if (options.writeFiles && (!fse.pathExistsSync(targetPath) || options.overwrite)) {
|
|
242
|
-
writePromises.push(
|
|
242
|
+
writePromises.push(
|
|
243
|
+
createOpenApiFrontmatter({
|
|
244
|
+
filename: targetPath,
|
|
245
|
+
openApiMetaTag: openapiMetaTag,
|
|
246
|
+
version: options.version,
|
|
247
|
+
deprecated: operation?.deprecated,
|
|
248
|
+
})
|
|
249
|
+
);
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
});
|