@rspress/core 2.0.0-beta.14 → 2.0.0-beta.15

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
@@ -47,6 +47,13 @@ declare interface DevOptions {
47
47
  extraBuilderConfig?: RsbuildConfig;
48
48
  }
49
49
 
50
+ declare interface InitOptions {
51
+ scanDir: string;
52
+ config: UserConfig;
53
+ runtimeTempDir: string;
54
+ pluginDriver: PluginDriver;
55
+ }
56
+
50
57
  export { mergeDocConfig }
51
58
 
52
59
  /**
@@ -151,17 +158,23 @@ declare type RootContent = RootContentMap[keyof RootContentMap];
151
158
  */
152
159
  declare interface RootData extends Data {}
153
160
 
161
+ declare class RoutePage {
162
+ routeMeta: RouteMeta;
163
+ static create(routeMeta: RouteMeta): RoutePage;
164
+ constructor(routeMeta: RouteMeta);
165
+ }
166
+
154
167
  export declare class RouteService {
155
168
  #private;
156
- routeData: Map<string, RouteMeta>;
169
+ routeData: Map<string, RoutePage>;
170
+ static create(options: InitOptions): Promise<RouteService>;
157
171
  constructor(scanDir: string, userConfig: UserConfig, tempDir: string, pluginDriver: PluginDriver);
158
172
  get extensions(): readonly string[];
159
- init(): Promise<void>;
160
- addRoute(routeInfo: RouteMeta): void;
173
+ addRoute(routeMeta: RouteMeta): Promise<void>;
161
174
  removeRoute(filePath: string): void;
162
175
  getRoutes(): RouteMeta[];
176
+ getRoutePages(): RoutePage[];
163
177
  isExistRoute(routePath: string): boolean;
164
- isEmpty(): boolean;
165
178
  generateRoutesCode(): string;
166
179
  generateRoutesCodeByRouteMeta(routeMeta: RouteMeta[]): string;
167
180
  getRoutePathParts(routePath: string): readonly [string, string, string];
@@ -170,6 +183,7 @@ export declare class RouteService {
170
183
  lang: string;
171
184
  version: string;
172
185
  };
186
+ getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
173
187
  }
174
188
 
175
189
  declare type RspressPluginHookKeys = 'beforeBuild' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'addSSGRoutes' | 'extendPageData' | 'modifySearchIndexData';