@rspress/core 1.0.0-beta.4 → 1.0.1
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/dist/index.js +608 -550
- package/dist/index.js.map +1 -1
- package/dist/loader.js +213 -156
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.js +30 -12
- package/dist/runtime/Content.js +11 -10
- package/dist/runtime/NoSSR.js +6 -5
- package/dist/runtime/clientEntry.js +13 -22
- package/dist/runtime/hooks.js +19 -11
- package/dist/runtime/index.js +32 -4
- package/dist/runtime/ssrEntry.js +10 -19
- package/dist/runtime/tsconfig.json +2 -1
- package/dist/runtime/utils.js +28 -8
- package/dist/theme/bundle.css +17 -17
- package/dist/theme/bundle.js +2162 -4963
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +13 -13
- package/src/runtime/App.tsx +21 -1
- package/src/runtime/tsconfig.json +2 -1
- package/src/theme-default/layout/Layout/index.tsx +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@mdx-js/loader": "2.2.1",
|
|
41
41
|
"@mdx-js/mdx": "2.2.1",
|
|
42
42
|
"@mdx-js/react": "2.2.1",
|
|
43
|
-
"@modern-js/builder": "2.
|
|
44
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
43
|
+
"@modern-js/builder": "2.36.0",
|
|
44
|
+
"@modern-js/builder-rspack-provider": "2.36.0",
|
|
45
45
|
"@rspress/mdx-rs": "0.3.3",
|
|
46
|
-
"@modern-js/utils": "2.
|
|
46
|
+
"@modern-js/utils": "2.36.0",
|
|
47
47
|
"@types/compression": "^1.7.2",
|
|
48
48
|
"@types/polka": "^0.5.4",
|
|
49
49
|
"autoprefixer": "10.4.13",
|
|
@@ -89,17 +89,17 @@
|
|
|
89
89
|
"unist-util-visit-children": "^2.0.1",
|
|
90
90
|
"yaml-front-matter": "^4.1.1",
|
|
91
91
|
"rspack-plugin-virtual-module": "0.1.12",
|
|
92
|
-
"@rspress/shared": "1.0.
|
|
93
|
-
"@rspress/plugin-medium-zoom": "1.0.
|
|
94
|
-
"@rspress/plugin-last-updated": "1.0.
|
|
95
|
-
"@rspress/plugin-auto-nav-sidebar": "1.0.
|
|
96
|
-
"@rspress/plugin-container-syntax": "1.0.
|
|
92
|
+
"@rspress/shared": "1.0.1",
|
|
93
|
+
"@rspress/plugin-medium-zoom": "1.0.1",
|
|
94
|
+
"@rspress/plugin-last-updated": "1.0.1",
|
|
95
|
+
"@rspress/plugin-auto-nav-sidebar": "1.0.1",
|
|
96
|
+
"@rspress/plugin-container-syntax": "1.0.1"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@modern-js/plugin-tailwindcss": "2.
|
|
100
|
-
"@modern-js/plugin-testing": "2.
|
|
101
|
-
"@modern-js/tsconfig": "2.
|
|
102
|
-
"@modern-js/types": "2.
|
|
99
|
+
"@modern-js/plugin-tailwindcss": "2.36.0",
|
|
100
|
+
"@modern-js/plugin-testing": "2.36.0",
|
|
101
|
+
"@modern-js/tsconfig": "2.36.0",
|
|
102
|
+
"@modern-js/types": "2.36.0",
|
|
103
103
|
"@types/body-scroll-lock": "^3.1.0",
|
|
104
104
|
"@types/fs-extra": "^9.0.13",
|
|
105
105
|
"@types/hast": "^2.3.4",
|
package/src/runtime/App.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import siteData from 'virtual-site-data';
|
|
2
2
|
import { matchRoutes, useLocation } from 'react-router-dom';
|
|
3
3
|
import { HelmetProvider } from 'react-helmet-async';
|
|
4
|
-
import { useContext, useLayoutEffect } from 'react';
|
|
4
|
+
import React, { useContext, useLayoutEffect } from 'react';
|
|
5
5
|
import { Header, PageData, cleanUrl, isProduction } from '@rspress/shared';
|
|
6
|
+
import globalComponents from 'virtual-global-components';
|
|
6
7
|
import { isEqualPath, normalizeRoutePath } from './utils';
|
|
7
8
|
import { DataContext } from './hooks';
|
|
8
9
|
import 'virtual-global-styles';
|
|
@@ -103,6 +104,25 @@ export function App({ helmetContext }: { helmetContext?: object }) {
|
|
|
103
104
|
return (
|
|
104
105
|
<HelmetProvider context={helmetContext}>
|
|
105
106
|
<Theme.Layout />
|
|
107
|
+
{
|
|
108
|
+
// Global UI
|
|
109
|
+
globalComponents.map((componentInfo, index) => {
|
|
110
|
+
if (Array.isArray(componentInfo)) {
|
|
111
|
+
const [component, props] = componentInfo;
|
|
112
|
+
return React.createElement(component, {
|
|
113
|
+
// The component order is stable
|
|
114
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
115
|
+
key: index,
|
|
116
|
+
...props,
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
return React.createElement(componentInfo, {
|
|
120
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
121
|
+
key: index,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}
|
|
106
126
|
</HelmetProvider>
|
|
107
127
|
);
|
|
108
128
|
}
|
|
@@ -3,7 +3,6 @@ import '../../styles';
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { Helmet } from 'react-helmet-async';
|
|
5
5
|
import Theme, { Nav } from '@theme';
|
|
6
|
-
import globalComponents from 'virtual-global-components';
|
|
7
6
|
import { DocLayout, DocLayoutProps } from '../DocLayout';
|
|
8
7
|
import { HomeLayoutProps } from '../HomeLayout';
|
|
9
8
|
import type { NavProps } from '../../components/Nav';
|
|
@@ -148,25 +147,6 @@ export const Layout: React.FC<LayoutProps> = props => {
|
|
|
148
147
|
|
|
149
148
|
<section>{getContentLayout()}</section>
|
|
150
149
|
{bottom}
|
|
151
|
-
{
|
|
152
|
-
// Global UI
|
|
153
|
-
globalComponents.map((componentInfo, index) => {
|
|
154
|
-
if (Array.isArray(componentInfo)) {
|
|
155
|
-
const [component, props] = componentInfo;
|
|
156
|
-
return React.createElement(component, {
|
|
157
|
-
// The component order is stable
|
|
158
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
159
|
-
key: index,
|
|
160
|
-
...props,
|
|
161
|
-
});
|
|
162
|
-
} else {
|
|
163
|
-
return React.createElement(componentInfo, {
|
|
164
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
165
|
-
key: index,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
}
|
|
170
150
|
</div>
|
|
171
151
|
);
|
|
172
152
|
};
|