@rspress/core 2.0.0-beta.2 → 2.0.0-beta.21
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/README.md +1 -1
- package/dist/208.js +39 -0
- package/dist/309.js +27 -0
- package/dist/94.js +1787 -0
- package/dist/index.d.ts +105 -19
- package/dist/index.js +1217 -561
- package/dist/loader.d.ts +38 -34
- package/dist/loader.js +30 -525
- package/dist/processor.d.ts +95 -0
- package/dist/processor.js +740 -0
- package/dist/runtime/App.d.ts +1 -4
- package/dist/runtime/App.js +17 -20
- package/dist/runtime/ClientApp.js +24 -13
- package/dist/runtime/csrClientEntry.js +5 -13
- package/dist/runtime/initPageData.d.ts +0 -1
- package/dist/runtime/initPageData.js +18 -18
- package/dist/runtime/ssrClientEntry.js +14 -14
- package/dist/runtime/ssrServerEntry.d.ts +3 -2
- package/dist/runtime/ssrServerEntry.js +41 -17
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.js +3 -0
- package/dist/shiki-transformers.d.ts +38 -0
- package/dist/shiki-transformers.js +77 -0
- package/dist/shiki-transformers.js.LICENSE.txt +5 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +1 -0
- package/package.json +40 -33
- package/static/MediumZoom.css +5 -0
- package/static/MediumZoom.tsx +29 -0
- package/dist/runtime/tsconfig.js +0 -4
- package/runtime.ts +0 -1
- package/theme.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
import { AdditionalPage } from '@rspress/shared';
|
|
2
2
|
import type { Data as Data_2 } from 'unist';
|
|
3
3
|
import { DefaultThemeConfig } from '@rspress/shared';
|
|
4
|
+
import { getIconUrlPath } from '@rspress/shared/node-utils';
|
|
5
|
+
import { getNodeAttribute } from '@rspress/shared/node-utils';
|
|
6
|
+
import { getSidebarDataGroup } from '@rspress/shared';
|
|
7
|
+
import { logger } from '@rspress/shared/logger';
|
|
8
|
+
import { matchPath } from '@rspress/runtime/server';
|
|
4
9
|
import { mergeDocConfig } from '@rspress/shared/node-utils';
|
|
10
|
+
import { Nav } from '@rspress/shared';
|
|
11
|
+
import { NavItemWithLink } from '@rspress/shared';
|
|
5
12
|
import type { Node as Node_3 } from 'unist';
|
|
6
|
-
import
|
|
13
|
+
import { normalizeHref } from '@rspress/shared';
|
|
14
|
+
import { normalizePosixPath } from '@rspress/shared';
|
|
15
|
+
import { PageIndexInfo } from '@rspress/shared';
|
|
7
16
|
import type { Plugin as Plugin_2 } from 'unified';
|
|
8
|
-
import
|
|
17
|
+
import { removeTrailingSlash } from '@rspress/shared';
|
|
18
|
+
import { RouteMeta } from '@rspress/shared';
|
|
9
19
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
10
20
|
import { RsbuildInstance } from '@rsbuild/core';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
21
|
+
import { RSPRESS_TEMP_DIR } from '@rspress/shared';
|
|
22
|
+
import { RspressPlugin } from '@rspress/shared';
|
|
23
|
+
import { Sidebar } from '@rspress/shared';
|
|
24
|
+
import { SidebarDivider } from '@rspress/shared';
|
|
25
|
+
import { SidebarGroup } from '@rspress/shared';
|
|
26
|
+
import { SidebarItem } from '@rspress/shared';
|
|
27
|
+
import { SidebarSectionHeader } from '@rspress/shared';
|
|
28
|
+
import { UserConfig } from '@rspress/shared';
|
|
29
|
+
import { withBase } from '@rspress/shared';
|
|
13
30
|
|
|
14
31
|
export declare function build(options: BuildOptions): Promise<void>;
|
|
15
32
|
|
|
16
33
|
declare interface BuildOptions {
|
|
17
34
|
docDirectory: string;
|
|
18
35
|
config: UserConfig;
|
|
36
|
+
configFilePath: string;
|
|
19
37
|
}
|
|
20
38
|
|
|
21
39
|
/**
|
|
@@ -44,11 +62,33 @@ declare interface DevOptions {
|
|
|
44
62
|
appDirectory: string;
|
|
45
63
|
docDirectory: string;
|
|
46
64
|
config: UserConfig;
|
|
65
|
+
configFilePath: string;
|
|
47
66
|
extraBuilderConfig?: RsbuildConfig;
|
|
48
67
|
}
|
|
49
68
|
|
|
69
|
+
export { getIconUrlPath }
|
|
70
|
+
|
|
71
|
+
export { getNodeAttribute }
|
|
72
|
+
|
|
73
|
+
export { getSidebarDataGroup }
|
|
74
|
+
|
|
75
|
+
declare interface InitOptions {
|
|
76
|
+
scanDir: string;
|
|
77
|
+
config: UserConfig;
|
|
78
|
+
runtimeTempDir: string;
|
|
79
|
+
pluginDriver: PluginDriver;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { logger }
|
|
83
|
+
|
|
84
|
+
export { matchPath }
|
|
85
|
+
|
|
50
86
|
export { mergeDocConfig }
|
|
51
87
|
|
|
88
|
+
export { Nav }
|
|
89
|
+
|
|
90
|
+
export { NavItemWithLink }
|
|
91
|
+
|
|
52
92
|
/**
|
|
53
93
|
* Abstract mdast node.
|
|
54
94
|
*
|
|
@@ -69,6 +109,12 @@ declare interface Node_2 extends Node_3 {
|
|
|
69
109
|
data?: Data | undefined;
|
|
70
110
|
}
|
|
71
111
|
|
|
112
|
+
export { normalizeHref }
|
|
113
|
+
|
|
114
|
+
export { normalizePosixPath }
|
|
115
|
+
|
|
116
|
+
export { PageIndexInfo }
|
|
117
|
+
|
|
72
118
|
/**
|
|
73
119
|
* Abstract mdast node that contains other mdast nodes (*children*).
|
|
74
120
|
*
|
|
@@ -85,7 +131,8 @@ declare interface Parent extends Node_2 {
|
|
|
85
131
|
|
|
86
132
|
declare class PluginDriver {
|
|
87
133
|
#private;
|
|
88
|
-
constructor(config: UserConfig, isProd: boolean);
|
|
134
|
+
constructor(config: UserConfig, configFilePath: string, isProd: boolean);
|
|
135
|
+
getConfigFilePath(): string;
|
|
89
136
|
init(): Promise<void>;
|
|
90
137
|
addPlugin(plugin: RspressPlugin): void;
|
|
91
138
|
getPlugins(): RspressPlugin[];
|
|
@@ -111,17 +158,24 @@ declare class PluginDriver {
|
|
|
111
158
|
_runSerialAsyncHook<H extends RspressPluginHookKeys>(hookName: H, ...args: Parameters<Required<RspressPlugin>[H]>): RspressPlugin;
|
|
112
159
|
}
|
|
113
160
|
|
|
161
|
+
export declare const remarkFileCodeBlock: Plugin_2<[{
|
|
162
|
+
filepath: string;
|
|
163
|
+
}], Root>;
|
|
164
|
+
|
|
114
165
|
/**
|
|
115
166
|
* Remark plugin to normalize a link href
|
|
116
167
|
*/
|
|
117
168
|
export declare const remarkPluginNormalizeLink: Plugin_2<[
|
|
118
169
|
{
|
|
119
|
-
root: string;
|
|
120
170
|
cleanUrls: boolean | string;
|
|
121
|
-
routeService
|
|
171
|
+
routeService: RouteService | null;
|
|
172
|
+
checkDeadLinks?: boolean;
|
|
173
|
+
__base?: string;
|
|
122
174
|
}
|
|
123
175
|
], Root>;
|
|
124
176
|
|
|
177
|
+
export { removeTrailingSlash }
|
|
178
|
+
|
|
125
179
|
/**
|
|
126
180
|
* Document fragment or a whole document.
|
|
127
181
|
*
|
|
@@ -151,33 +205,54 @@ declare type RootContent = RootContentMap[keyof RootContentMap];
|
|
|
151
205
|
*/
|
|
152
206
|
declare interface RootData extends Data {}
|
|
153
207
|
|
|
208
|
+
export { RouteMeta }
|
|
209
|
+
|
|
210
|
+
declare class RoutePage {
|
|
211
|
+
#private;
|
|
212
|
+
routeMeta: RouteMeta;
|
|
213
|
+
static create(absolutePath: string, docsDir: string): RoutePage;
|
|
214
|
+
static createFromExternal(routePath: string, filepath: string, docDir: string): RoutePage;
|
|
215
|
+
private constructor();
|
|
216
|
+
static generateRouteMeta(routePath: string, filepath: string, docDir: string): RouteMeta;
|
|
217
|
+
}
|
|
218
|
+
|
|
154
219
|
export declare class RouteService {
|
|
155
220
|
#private;
|
|
156
|
-
routeData: Map<string,
|
|
157
|
-
|
|
221
|
+
routeData: Map<string, RoutePage>;
|
|
222
|
+
static __instance__: RouteService | null;
|
|
223
|
+
static getInstance(): RouteService;
|
|
224
|
+
static create(options: InitOptions): Promise<RouteService>;
|
|
225
|
+
private constructor();
|
|
158
226
|
get extensions(): readonly string[];
|
|
159
|
-
|
|
160
|
-
addRoute(routeInfo: RouteMeta): void;
|
|
161
|
-
removeRoute(filePath: string): void;
|
|
227
|
+
addRoute(routePage: RoutePage): Promise<void>;
|
|
162
228
|
getRoutes(): RouteMeta[];
|
|
229
|
+
getRoutePages(): RoutePage[];
|
|
163
230
|
isExistRoute(routePath: string): boolean;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
231
|
+
generateRoutesCode(): string;
|
|
232
|
+
private generateRoutesCodeByRouteMeta;
|
|
233
|
+
getRoutePathParts(relativePath: string): readonly [string, string, string];
|
|
234
|
+
normalizeRoutePath(relativePath: string): {
|
|
235
|
+
pureRoutePath: string;
|
|
169
236
|
routePath: string;
|
|
170
237
|
lang: string;
|
|
171
238
|
version: string;
|
|
172
239
|
};
|
|
240
|
+
absolutePathToRoutePath(absolutePath: string): string;
|
|
241
|
+
absolutePathToRelativePath(absolutePath: string): string;
|
|
242
|
+
getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
|
|
173
243
|
}
|
|
174
244
|
|
|
175
|
-
|
|
245
|
+
export { RSPRESS_TEMP_DIR }
|
|
246
|
+
|
|
247
|
+
export { RspressPlugin }
|
|
248
|
+
|
|
249
|
+
declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'addSSGRoutes' | 'extendPageData' | 'modifySearchIndexData';
|
|
176
250
|
|
|
177
251
|
export declare function serve(options: ServeOptions): Promise<ReturnType<RsbuildInstance['preview']>>;
|
|
178
252
|
|
|
179
253
|
declare interface ServeOptions {
|
|
180
254
|
config: UserConfig;
|
|
255
|
+
configFilePath: string;
|
|
181
256
|
port?: number;
|
|
182
257
|
host?: string;
|
|
183
258
|
}
|
|
@@ -186,7 +261,18 @@ declare interface ServerInstance {
|
|
|
186
261
|
close: () => Promise<void>;
|
|
187
262
|
}
|
|
188
263
|
|
|
264
|
+
export { Sidebar }
|
|
265
|
+
|
|
266
|
+
export { SidebarDivider }
|
|
267
|
+
|
|
268
|
+
export { SidebarGroup }
|
|
269
|
+
|
|
270
|
+
export { SidebarItem }
|
|
271
|
+
|
|
272
|
+
export { SidebarSectionHeader }
|
|
273
|
+
|
|
274
|
+
export { UserConfig }
|
|
189
275
|
|
|
190
|
-
export
|
|
276
|
+
export { withBase }
|
|
191
277
|
|
|
192
278
|
export { }
|