@mintlify/scraping 4.0.1184 → 4.0.1186

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.1184",
3
+ "version": "4.0.1186",
4
4
  "description": "Scrape documentation frameworks to Mintlify docs",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -87,5 +87,5 @@
87
87
  "optional": true
88
88
  }
89
89
  },
90
- "gitHead": "7c0206add0761d1ed8d623e11e9d9a0b9c010663"
90
+ "gitHead": "56c5bd31977d73c877d2a8364d34f971020c3d46"
91
91
  }
@@ -198,12 +198,28 @@ export async function convertGo(sourcePath: string): Promise<SdkReference> {
198
198
  for (const renderer of renderers) {
199
199
  const packagePages = renderer.packagePages();
200
200
  pages.push(...packagePages, ...renderer.memberPages());
201
- groups.push({ group: renderer.group, pages: packagePages.map((page) => page.slug) });
201
+ groups.push({ group: renderer.group, pages: packageEntries(packagePages) });
202
202
  }
203
203
 
204
204
  return { pages, groups };
205
205
  }
206
206
 
207
+ const KIND_GROUPS = [
208
+ { tag: TYPE_TAGS.interface, group: 'Interfaces' },
209
+ { tag: TYPE_TAGS.struct, group: 'Structs' },
210
+ { tag: TYPE_TAGS.defined, group: 'Types' },
211
+ { tag: 'FUNCTION', group: 'Functions' },
212
+ ];
213
+
214
+ function packageEntries([overview, ...rest]: SdkPage[]): (string | SdkNavGroup)[] {
215
+ const buckets = KIND_GROUPS.map(({ tag, group }) => ({
216
+ group,
217
+ pages: rest.filter((page) => page.tag === tag).map((page) => page.slug),
218
+ })).filter((bucket) => bucket.pages.length > 0);
219
+ const entries = buckets.length > 1 ? buckets : rest.map((page) => page.slug);
220
+ return overview ? [overview.slug, ...entries] : entries;
221
+ }
222
+
207
223
  function parseArtifact(raw: unknown, sourcePath: string): GoArtifact {
208
224
  const version =
209
225
  typeof raw === 'object' && raw !== null && 'schemaVersion' in raw
@@ -361,14 +377,11 @@ class GoIndex {
361
377
 
362
378
  href(importPath: string, name: string | undefined, isPrivate: boolean): string | undefined {
363
379
  if (name) {
364
- const dot = name.indexOf('.');
365
- const location =
366
- this.symbols.get(`${importPath}#${name}`) ??
367
- (dot > 0 ? this.symbols.get(`${importPath}#${name.slice(0, dot)}`) : undefined);
380
+ const location = this.symbols.get(`${importPath}#${name}`);
368
381
  if (location) return `/${location.slug}${location.anchor ? `#${location.anchor}` : ''}`;
369
382
  }
370
383
  const packageSlug = this.packages.get(importPath);
371
- if (packageSlug) return `/${packageSlug}`;
384
+ if (packageSlug) return name ? undefined : `/${packageSlug}`;
372
385
  if (isPrivate) return undefined;
373
386
  return `https://pkg.go.dev/${encodeHref(importPath)}${name ? `#${encodeHref(name)}` : ''}`;
374
387
  }