@mintlify/common 1.0.399 → 1.0.400

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.
@@ -8,6 +8,9 @@ export function generatePathToLanguageDict(nav) {
8
8
  function traverseNavigation(pathToLanguageDict, nav, nearestLanguage) {
9
9
  const currentLanguage = 'language' in nav ? nav.language : nearestLanguage;
10
10
  if ('pages' in nav) {
11
+ if ('root' in nav && typeof nav.root === 'object') {
12
+ traverseGroup(pathToLanguageDict, nav.root, currentLanguage);
13
+ }
11
14
  nav.pages.forEach((page) => traverseGroup(pathToLanguageDict, page, currentLanguage));
12
15
  return;
13
16
  }
@@ -20,6 +23,9 @@ function traverseNavigation(pathToLanguageDict, nav, nearestLanguage) {
20
23
  }
21
24
  function traverseGroup(pathToLanguageDict, entry, nearestLanguage) {
22
25
  if ('pages' in entry) {
26
+ if ('root' in entry && typeof entry.root === 'object') {
27
+ traverseGroup(pathToLanguageDict, entry.root, nearestLanguage);
28
+ }
23
29
  entry.pages.forEach((page) => traverseGroup(pathToLanguageDict, page, nearestLanguage));
24
30
  }
25
31
  else if ('href' in entry) {
@@ -24,6 +24,9 @@ function generatePathToVersionDictRecursive(pathToVersionDict, nav, nearestVersi
24
24
  }
25
25
  }
26
26
  if ('pages' in nav) {
27
+ if ('root' in nav && typeof nav.root === 'object') {
28
+ generatePathToVersionDictRecursive(pathToVersionDict, nav.root, nearestVersion);
29
+ }
27
30
  for (const page of nav.pages) {
28
31
  if (typeof page === 'object') {
29
32
  generatePathToVersionDictRecursive(pathToVersionDict, page, nearestVersion);
@@ -8,6 +8,9 @@ export function generatePathToVersionDictForDocsConfig(nav) {
8
8
  function traverseNavigation(pathToVersionDict, nav, nearestVersion) {
9
9
  const currentVersion = 'version' in nav ? nav.version : nearestVersion;
10
10
  if ('pages' in nav) {
11
+ if ('root' in nav && typeof nav.root === 'object') {
12
+ traverseGroup(pathToVersionDict, nav.root, currentVersion);
13
+ }
11
14
  nav.pages.forEach((page) => traverseGroup(pathToVersionDict, page, currentVersion));
12
15
  return;
13
16
  }
@@ -21,6 +24,9 @@ function traverseNavigation(pathToVersionDict, nav, nearestVersion) {
21
24
  function traverseGroup(pathToVersionDict, entry, nearestVersion) {
22
25
  if ('pages' in entry) {
23
26
  const currentVersion = 'version' in entry ? entry.version : nearestVersion;
27
+ if ('root' in entry && typeof entry.root === 'object') {
28
+ traverseGroup(pathToVersionDict, entry.root, currentVersion);
29
+ }
24
30
  entry.pages.forEach((page) => traverseGroup(pathToVersionDict, page, currentVersion));
25
31
  }
26
32
  else if ('href' in entry) {
@@ -1,6 +1,9 @@
1
1
  import { divisions } from '@mintlify/validation';
2
2
  export function getAllPathsInDocsNav(nav, paths = []) {
3
3
  if ('pages' in nav) {
4
+ if ('root' in nav) {
5
+ getPaths(nav.root, paths);
6
+ }
4
7
  nav.pages.forEach((page) => getPaths(page, paths));
5
8
  return paths;
6
9
  }
@@ -18,6 +21,9 @@ function getPaths(entry, paths) {
18
21
  return;
19
22
  }
20
23
  if ('pages' in entry) {
24
+ if ('root' in entry && typeof entry.root === 'object') {
25
+ getPaths(entry.root, paths);
26
+ }
21
27
  entry.pages.forEach((page) => {
22
28
  getPaths(page, paths);
23
29
  });
@@ -9,6 +9,13 @@ export function getFirstPageFromNavigation(node) {
9
9
  return node;
10
10
  }
11
11
  if ('pages' in node) {
12
+ if ('root' in node && typeof node.root === 'object') {
13
+ const page = getFirstPageFromNavigation(node.root);
14
+ if (page) {
15
+ page.href = replaceSlashIndex(page.href);
16
+ return page;
17
+ }
18
+ }
12
19
  for (const page of node.pages) {
13
20
  if (typeof page === 'object') {
14
21
  const pagePath = getFirstPageFromNavigation(page);