@rspress/core 1.11.1 → 1.12.0

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,13 +8,7 @@ import {
8
8
  } from '@rspress/runtime';
9
9
  import { HelmetProvider } from 'react-helmet-async';
10
10
  import React, { useContext, useLayoutEffect } from 'react';
11
- import {
12
- Header,
13
- PageData,
14
- cleanUrl,
15
- isProduction,
16
- MDX_REGEXP,
17
- } from '@rspress/shared';
11
+ import { Header, PageData, cleanUrl, MDX_REGEXP } from '@rspress/shared';
18
12
  import globalComponents from 'virtual-global-components';
19
13
  import 'virtual-global-styles';
20
14
 
@@ -69,13 +63,7 @@ export async function initPageData(routePath: string): Promise<PageData> {
69
63
  pageType: frontmatter?.pageType || 'doc',
70
64
  title,
71
65
  frontmatter,
72
- // Trade off:
73
- // 1. the `extractPageInfo` includes complete toc even if import doc fragments, because we use `flattenMdxContent` function to make all doc fragments' toc included.However, it is only computed once when build
74
- // 2. the mod.toc is not complete toc, but it is computed every time through loader when doc changed
75
- // We choose the better solutions for different environments:
76
- // In production, we use the extractPageInfo.toc to ensure the toc is complete and accurate.
77
- // In development, we use the mod.toc to ensure the toc is up to date to ensure DX.However, we cannot ensure the complete toc info when including doc fragments.
78
- toc: isProduction() ? extractPageInfo?.toc : toc,
66
+ toc,
79
67
  },
80
68
  };
81
69
  } else {