@mintlify/scraping 4.0.1211 → 4.0.1213
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.
|
|
3
|
+
"version": "4.0.1213",
|
|
4
4
|
"description": "Scrape documentation frameworks to Mintlify docs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"format:check": "oxfmt --check"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@mintlify/common": "1.0.
|
|
46
|
+
"@mintlify/common": "1.0.1334",
|
|
47
47
|
"fast-xml-parser": "5.7.3",
|
|
48
48
|
"fs-extra": "11.1.1",
|
|
49
49
|
"graphql": "16.11.0",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"zod": "3.24.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@mintlify/models": "0.0.
|
|
65
|
+
"@mintlify/models": "0.0.385",
|
|
66
66
|
"@mintlify/ts-config": "2.0.2",
|
|
67
|
-
"@mintlify/validation": "0.1.
|
|
67
|
+
"@mintlify/validation": "0.1.956",
|
|
68
68
|
"@tsconfig/recommended": "1.0.2",
|
|
69
69
|
"@types/hast": "3.0.4",
|
|
70
70
|
"@types/mdast": "4.0.4",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"optional": true
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "29387ac467c064ff32bc66c6a84dc41fc1abbfab"
|
|
91
91
|
}
|
|
@@ -18,6 +18,7 @@ export function buildSphinxNavigation(docs: SphinxNavigationDoc[]): SdkNavGroup[
|
|
|
18
18
|
const children = new Map<string, string[]>();
|
|
19
19
|
const parents = new Map<string, string[]>();
|
|
20
20
|
const guideContent = new Set<string>();
|
|
21
|
+
const generated = new Set<string>();
|
|
21
22
|
|
|
22
23
|
function addChild(parent: string, child: string): void {
|
|
23
24
|
if (parent === child) return;
|
|
@@ -31,7 +32,8 @@ export function buildSphinxNavigation(docs: SphinxNavigationDoc[]): SdkNavGroup[
|
|
|
31
32
|
|
|
32
33
|
for (const doc of docs) {
|
|
33
34
|
const body = htmlToHast(doc.body);
|
|
34
|
-
if (
|
|
35
|
+
if (isGeneratedReference(body)) generated.add(doc.slug);
|
|
36
|
+
else if (hasGuideContent(body)) guideContent.add(doc.slug);
|
|
35
37
|
const wrappers = toctreeWrappers(body);
|
|
36
38
|
const sources: (Root | Element)[] = wrappers;
|
|
37
39
|
if (!sources.length && doc.toc) sources.push(htmlToHast(doc.toc));
|
|
@@ -87,7 +89,9 @@ export function buildSphinxNavigation(docs: SphinxNavigationDoc[]): SdkNavGroup[
|
|
|
87
89
|
if (ancestor) addChild(ancestor, doc.slug);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
const reference = new Set(
|
|
92
|
+
const reference = new Set(
|
|
93
|
+
docs.filter((doc) => doc.tag || generated.has(doc.slug)).map((doc) => doc.slug)
|
|
94
|
+
);
|
|
91
95
|
let changed = true;
|
|
92
96
|
while (changed) {
|
|
93
97
|
changed = false;
|
|
@@ -143,13 +147,21 @@ export function buildSphinxNavigation(docs: SphinxNavigationDoc[]): SdkNavGroup[
|
|
|
143
147
|
);
|
|
144
148
|
for (const doc of [...roots, ...categoryDocs])
|
|
145
149
|
pages.push(...entries(doc.slug, category, emitted));
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
150
|
+
const group = category ? 'API Reference' : 'Getting Started';
|
|
151
|
+
const flattened = flattenGroup(pages, group);
|
|
152
|
+
if (flattened.length) groups.push({ group, pages: flattened });
|
|
149
153
|
}
|
|
150
154
|
return groups;
|
|
151
155
|
}
|
|
152
156
|
|
|
157
|
+
function flattenGroup(pages: (string | SdkNavGroup)[], title: string): (string | SdkNavGroup)[] {
|
|
158
|
+
return pages.flatMap((page) => {
|
|
159
|
+
if (typeof page === 'string') return [page];
|
|
160
|
+
const nested = flattenGroup(page.pages, title);
|
|
161
|
+
return page.group === title ? nested : [{ ...page, pages: nested }];
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
153
165
|
function ancestorPrefixes(slug: string): string[] {
|
|
154
166
|
return [...slug.matchAll(/[/.]/g)].map((match) => slug.slice(0, match.index));
|
|
155
167
|
}
|
|
@@ -212,6 +224,17 @@ function resolvePageHref(
|
|
|
212
224
|
return;
|
|
213
225
|
}
|
|
214
226
|
|
|
227
|
+
function isGeneratedReference(node: Root | Element): boolean {
|
|
228
|
+
if (node.type === 'element') {
|
|
229
|
+
const { id, href } = node.properties;
|
|
230
|
+
if (typeof id === 'string' && id.startsWith('module-')) return true;
|
|
231
|
+
if (typeof href === 'string' && /github\.com\/readthedocs\/sphinx-autoapi/.test(href)) {
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return node.children.some((child) => child.type === 'element' && isGeneratedReference(child));
|
|
236
|
+
}
|
|
237
|
+
|
|
215
238
|
function hasGuideContent(node: Root | Element): boolean {
|
|
216
239
|
if (node.type === 'element') {
|
|
217
240
|
if (classes(node).includes('toctree-wrapper')) return false;
|