@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/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 type { PageIndexInfo } from '@rspress/shared';
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 type { RouteMeta } from '@rspress/shared';
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 type { RspressPlugin } from '@rspress/shared';
12
- import type { UserConfig } from '@rspress/shared';
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?: 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, RouteMeta>;
157
- constructor(scanDir: string, userConfig: UserConfig, tempDir: string, pluginDriver: PluginDriver);
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
- init(): Promise<void>;
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
- isEmpty(): boolean;
165
- generateRoutesCode(isStaticImport?: boolean): string;
166
- generateRoutesCodeByRouteMeta(routeMeta: RouteMeta[], isStaticImport: boolean): string;
167
- getRoutePathParts(routePath: string): readonly [string, string, string];
168
- normalizeRoutePath(routePath: string): {
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
- declare type RspressPluginHookKeys = 'beforeBuild' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'addSSGRoutes' | 'extendPageData' | 'modifySearchIndexData';
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 * from "@rspress/shared";
276
+ export { withBase }
191
277
 
192
278
  export { }