@rspress/core 1.8.2 → 1.8.3

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.
Files changed (34) hide show
  1. package/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  2. package/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
  3. package/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  4. package/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  5. package/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  6. package/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  7. package/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
  8. package/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  9. package/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
  10. package/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  11. package/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
  12. package/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  13. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  14. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  15. package/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
  16. package/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  17. package/compiled/fast-glob/index.js +37 -0
  18. package/compiled/fast-glob/license +21 -0
  19. package/compiled/fast-glob/out/index.d.ts +27 -0
  20. package/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
  21. package/compiled/fast-glob/out/settings.d.ts +164 -0
  22. package/compiled/fast-glob/out/types/index.d.ts +31 -0
  23. package/compiled/fast-glob/package.json +1 -0
  24. package/compiled/globby/index.d.ts +186 -0
  25. package/compiled/globby/index.js +1 -0
  26. package/compiled/globby/license +9 -0
  27. package/compiled/globby/package.json +1 -0
  28. package/dist/index.js +20 -16
  29. package/dist/index.js.map +1 -1
  30. package/dist/loader.js +1 -2
  31. package/dist/loader.js.map +1 -1
  32. package/dist/runtime/App.js +8 -3
  33. package/package.json +13 -13
  34. package/src/runtime/App.tsx +18 -14
@@ -9,7 +9,11 @@ import {
9
9
  } from "@rspress/runtime";
10
10
  import { HelmetProvider } from "react-helmet-async";
11
11
  import React, { useContext, useLayoutEffect } from "react";
12
- import { cleanUrl, isProduction } from "@rspress/shared";
12
+ import {
13
+ cleanUrl,
14
+ isProduction,
15
+ MDX_REGEXP
16
+ } from "@rspress/shared";
13
17
  import globalComponents from "virtual-global-components";
14
18
  import "virtual-global-styles";
15
19
  const { default: Theme } = require("@theme");
@@ -33,11 +37,12 @@ async function initPageData(routePath) {
33
37
  return isEqualPath(normalize(page.routePath), normalize(routePath));
34
38
  });
35
39
  const encodedPagePath = encodeURIComponent(pagePath);
40
+ const meta = mod.default.__RSPRESS_PAGE_META?.[encodedPagePath] || {};
36
41
  const {
37
42
  toc = [],
38
43
  title = "",
39
- frontmatter
40
- } = mod.default.__RSPRESS_PAGE_META?.[encodedPagePath] || {};
44
+ frontmatter = {}
45
+ } = MDX_REGEXP.test(matchedRoute.filePath) ? meta : mod;
41
46
  return {
42
47
  siteData,
43
48
  page: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -41,9 +41,9 @@
41
41
  "@mdx-js/mdx": "2.2.1",
42
42
  "@mdx-js/react": "2.2.1",
43
43
  "@modern-js/utils": "2.42.0",
44
- "@rsbuild/core": "0.1.9",
45
- "@rsbuild/plugin-react": "0.1.9",
46
- "@rsbuild/plugin-svgr": "0.1.9",
44
+ "@rsbuild/core": "0.2.1",
45
+ "@rsbuild/plugin-react": "0.2.1",
46
+ "@rsbuild/plugin-svgr": "0.2.1",
47
47
  "@rspress/mdx-rs": "0.4.3",
48
48
  "@types/compression": "^1.7.2",
49
49
  "@types/polka": "^0.5.4",
@@ -55,7 +55,6 @@
55
55
  "flexsearch": "0.6.32",
56
56
  "fs-extra": "10.1.0",
57
57
  "github-slugger": "^2.0.0",
58
- "globby": "11.1.0",
59
58
  "hast-util-from-html": "^1.0.0",
60
59
  "hast-util-heading-rank": "^3.0.0",
61
60
  "html-to-text": "^9.0.3",
@@ -89,13 +88,13 @@
89
88
  "unist-util-visit": "^4.1.1",
90
89
  "unist-util-visit-children": "^2.0.1",
91
90
  "yaml-front-matter": "^4.1.1",
92
- "@rspress/theme-default": "1.8.2",
93
- "@rspress/runtime": "1.8.2",
94
- "@rspress/plugin-last-updated": "1.8.2",
95
- "@rspress/plugin-auto-nav-sidebar": "1.8.2",
96
- "@rspress/plugin-container-syntax": "1.8.2",
97
- "@rspress/plugin-medium-zoom": "1.8.2",
98
- "@rspress/shared": "1.8.2"
91
+ "@rspress/theme-default": "1.8.3",
92
+ "@rspress/plugin-last-updated": "1.8.3",
93
+ "@rspress/plugin-auto-nav-sidebar": "1.8.3",
94
+ "@rspress/runtime": "1.8.3",
95
+ "@rspress/plugin-medium-zoom": "1.8.3",
96
+ "@rspress/plugin-container-syntax": "1.8.3",
97
+ "@rspress/shared": "1.8.3"
99
98
  },
100
99
  "devDependencies": {
101
100
  "@modern-js/plugin-tailwindcss": "2.42.0",
@@ -141,7 +140,8 @@
141
140
  "index.html",
142
141
  "runtime.ts",
143
142
  "theme.ts",
144
- "loader.cjs"
143
+ "loader.cjs",
144
+ "compiled"
145
145
  ],
146
146
  "publishConfig": {
147
147
  "access": "public",
@@ -8,7 +8,13 @@ import {
8
8
  } from '@rspress/runtime';
9
9
  import { HelmetProvider } from 'react-helmet-async';
10
10
  import React, { useContext, useLayoutEffect } from 'react';
11
- import { Header, PageData, cleanUrl, isProduction } from '@rspress/shared';
11
+ import {
12
+ Header,
13
+ PageData,
14
+ cleanUrl,
15
+ isProduction,
16
+ MDX_REGEXP,
17
+ } from '@rspress/shared';
12
18
  import globalComponents from 'virtual-global-components';
13
19
  import 'virtual-global-styles';
14
20
 
@@ -20,14 +26,11 @@ export enum QueryStatus {
20
26
  Hide = '0',
21
27
  }
22
28
 
23
- type RspressPageMeta = Record<
24
- string,
25
- {
26
- title: string;
27
- toc: Header[];
28
- frontmatter: Record<string, any>;
29
- }
30
- >;
29
+ type PageMeta = {
30
+ title: string;
31
+ toc: Header[];
32
+ frontmatter: Record<string, any>;
33
+ };
31
34
 
32
35
  export async function initPageData(routePath: string): Promise<PageData> {
33
36
  const { routes } = process.env.__SSR__
@@ -49,14 +52,15 @@ export async function initPageData(routePath: string): Promise<PageData> {
49
52
  // FIXME: when sidebar item is configured as link string, the sidebar text won't updated when page title changed
50
53
  // Reason: The sidebar item text depends on pageData, which is not updated when page title changed, because the pageData is computed once when build
51
54
  const encodedPagePath = encodeURIComponent(pagePath);
55
+ const meta: PageMeta =
56
+ mod.default.__RSPRESS_PAGE_META?.[encodedPagePath] || {};
57
+ // mdx loader will generate __RSPRESS_PAGE_META,
58
+ // if the filePath don't match it, we can get meta from j(t)sx if we customize it
52
59
  const {
53
60
  toc = [],
54
61
  title = '',
55
- frontmatter,
56
- } = (mod.default.__RSPRESS_PAGE_META as RspressPageMeta)?.[
57
- encodedPagePath
58
- ] || {};
59
-
62
+ frontmatter = {},
63
+ } = MDX_REGEXP.test(matchedRoute.filePath) ? meta : mod;
60
64
  return {
61
65
  siteData,
62
66
  page: {