@mintlify/scraping 4.0.327 → 4.0.329

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/scraping",
3
- "version": "4.0.327",
3
+ "version": "4.0.329",
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.471",
41
+ "@mintlify/common": "1.0.472",
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.216",
62
62
  "@mintlify/prettier-config": "1.0.4",
63
63
  "@mintlify/ts-config": "2.0.2",
64
- "@mintlify/validation": "0.1.431",
64
+ "@mintlify/validation": "0.1.432",
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": "020d9ebcbfe590f2cd2bce472dea0a5f27f8dbbf"
80
+ "gitHead": "a3394aaa3205b5b336d2a01a346659bc0b0112c7"
81
81
  }
@@ -21,6 +21,7 @@ import {
21
21
  generateUniqueFilenameWithoutExtension,
22
22
  } from '../apiPages/common.js';
23
23
  import { fetchOpenApi } from '../utils/network.js';
24
+ import { registerXMintContent } from './contentRegistry.js';
24
25
 
25
26
  export type OpenApiExtensions = {
26
27
  'x-mint'?: XMint;
@@ -202,12 +203,13 @@ export function processOpenApiPath<N, DN>(
202
203
  openapiMetaTag
203
204
  );
204
205
  const page: DecoratedNavigationPage = {
205
- openapi: openapiMetaTag,
206
- href: resolve('/', filenameWithoutExtension),
207
- title: xMint?.metadata?.title ?? titleTag ?? slugToTitle(filenameWithoutExtension),
208
- description: xMint?.metadata?.description ?? description,
206
+ title: titleTag ?? slugToTitle(filenameWithoutExtension),
207
+ description,
209
208
  deprecated: operation?.deprecated,
210
209
  version: options.version,
210
+ ...xMint?.metadata,
211
+ openapi: openapiMetaTag,
212
+ href: resolve('/', filenameWithoutExtension),
211
213
  };
212
214
 
213
215
  if (!isHiddenOperation(operation as MaybeOperationObjectWithExtensions)) {
@@ -216,6 +218,10 @@ export function processOpenApiPath<N, DN>(
216
218
  }
217
219
  pagesAcc[filenameWithoutExtension] = page;
218
220
 
221
+ if (!options.writeFiles) {
222
+ registerXMintContent(filenameWithoutExtension, xMint?.content);
223
+ }
224
+
219
225
  const targetPath = options.outDirBasePath
220
226
  ? join(options.outDirBasePath, `${filenameWithoutExtension}.mdx`)
221
227
  : `${filenameWithoutExtension}.mdx`;
@@ -288,15 +294,14 @@ export function processOpenApiWebhook<N, DN>(
288
294
  path: webhook,
289
295
  });
290
296
 
291
- const description = xMint?.metadata?.description ?? operation?.description;
292
-
293
297
  const page: DecoratedNavigationPage = {
294
- openapi: openapiMetaTag,
295
- href: resolve('/', filenameWithoutExtension),
296
- title: xMint?.metadata?.title ?? slugToTitle(filenameWithoutExtension),
297
- description,
298
+ title: slugToTitle(filenameWithoutExtension),
299
+ description: operation?.description,
298
300
  version: options.version,
299
301
  deprecated: operation?.deprecated,
302
+ ...xMint?.metadata,
303
+ openapi: openapiMetaTag,
304
+ href: resolve('/', filenameWithoutExtension),
300
305
  };
301
306
 
302
307
  if (!isHiddenOperation(operation as MaybeOperationObjectWithExtensions)) {
@@ -304,6 +309,11 @@ export function processOpenApiWebhook<N, DN>(
304
309
  decoratedNavGroup.push(page);
305
310
  }
306
311
  pagesAcc[filenameWithoutExtension] = page;
312
+
313
+ if (!options.writeFiles) {
314
+ registerXMintContent(filenameWithoutExtension, xMint?.content);
315
+ }
316
+
307
317
  const targetPath = options.outDirBasePath
308
318
  ? join(options.outDirBasePath, `${filenameWithoutExtension}.mdx`)
309
319
  : `${filenameWithoutExtension}.mdx`;
@@ -0,0 +1,13 @@
1
+ const registry = new Map<string, string>();
2
+
3
+ export function registerXMintContent(slug: string, content?: string) {
4
+ if (content) registry.set(slug, content);
5
+ }
6
+
7
+ export function getXMintContent(slug: string): string | undefined {
8
+ return registry.get(slug);
9
+ }
10
+
11
+ export function getAllXMintContent(): Map<string, string> {
12
+ return new Map(registry);
13
+ }