@rspress/core 2.0.0-beta.3 → 2.0.0-beta.30

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.
@@ -0,0 +1,93 @@
1
+ import { AdditionalPage } from '@rspress/shared';
2
+ import { DefaultThemeConfig } from '@rspress/shared';
3
+ import type { PageIndexInfo } from '@rspress/shared';
4
+ import { RouteMeta } from '@rspress/shared';
5
+ import type { Rspack as Rspack_2 } from '@rsbuild/core';
6
+ import type { RspressPlugin } from '@rspress/shared';
7
+ import { UserConfig } from '@rspress/shared';
8
+
9
+ export declare function compile(options: CompileOptions): Promise<string>;
10
+
11
+ declare interface CompileOptions {
12
+ source: string;
13
+ filepath: string;
14
+ docDirectory: string;
15
+ config: UserConfig | null;
16
+ routeService: RouteService | null;
17
+ pluginDriver: PluginDriver | null;
18
+ addDependency?: Rspack_2.LoaderContext['addDependency'];
19
+ }
20
+
21
+ export declare function compileWithCrossCompilerCache(options: CompileOptions): Promise<string>;
22
+
23
+ declare interface InitOptions {
24
+ scanDir: string;
25
+ config: UserConfig;
26
+ runtimeTempDir: string;
27
+ pluginDriver: PluginDriver;
28
+ }
29
+
30
+ declare class PluginDriver {
31
+ #private;
32
+ constructor(config: UserConfig, configFilePath: string, isProd: boolean);
33
+ getConfigFilePath(): string;
34
+ init(): Promise<void>;
35
+ addPlugin(plugin: RspressPlugin): void;
36
+ getPlugins(): RspressPlugin[];
37
+ clearPlugins(): void;
38
+ removePlugin(pluginName: string): void;
39
+ modifyConfig(): Promise<UserConfig<DefaultThemeConfig>>;
40
+ beforeBuild(): Promise<void[]>;
41
+ afterBuild(): Promise<void[]>;
42
+ modifySearchIndexData(pages: PageIndexInfo[]): Promise<void[]>;
43
+ extendPageData(pageData: PageIndexInfo): Promise<void[]>;
44
+ addPages(): Promise<AdditionalPage[]>;
45
+ routeGenerated(routes: RouteMeta[]): Promise<void[]>;
46
+ routeServiceGenerated(routeService: RouteService): Promise<void[]>;
47
+ addRuntimeModules(): Promise<Record<string, string>>;
48
+ globalUIComponents(): (string | [string, object])[];
49
+ globalStyles(): string[];
50
+ _runParallelAsyncHook<H extends RspressPluginHookKeys>(hookName: H, ...args: Parameters<Required<RspressPlugin>[H]>): Promise<Awaited<ReturnType<Required<RspressPlugin>[H]>>[]>;
51
+ _runSerialAsyncHook<H extends RspressPluginHookKeys>(hookName: H, ...args: Parameters<Required<RspressPlugin>[H]>): RspressPlugin;
52
+ }
53
+
54
+ declare class RoutePage {
55
+ #private;
56
+ routeMeta: RouteMeta;
57
+ static create(absolutePath: string, docsDir: string): RoutePage;
58
+ static createFromExternal(routePath: string, filepath: string, docDir: string): RoutePage;
59
+ private constructor();
60
+ static generateRouteMeta(routePath: string, filepath: string, docDir: string): RouteMeta;
61
+ }
62
+
63
+ declare class RouteService {
64
+ #private;
65
+ routeData: Map<string, RoutePage>;
66
+ static __instance__: RouteService | null;
67
+ static getInstance(): RouteService;
68
+ static create(options: InitOptions): Promise<RouteService>;
69
+ private constructor();
70
+ get extensions(): readonly string[];
71
+ addRoute(routePage: RoutePage): Promise<void>;
72
+ getRoutes(): RouteMeta[];
73
+ getRoutePages(): RoutePage[];
74
+ isExistRoute(link: string): boolean;
75
+ generateRoutesCode(): string;
76
+ private generateRoutesCodeByRouteMeta;
77
+ getRoutePathParts(relativePath: string): string[];
78
+ splitRoutePathParts(relativePath: string): readonly [string, string, string];
79
+ normalizeRoutePath(relativePath: string): {
80
+ pureRoutePath: string;
81
+ routePath: string;
82
+ lang: string;
83
+ version: string;
84
+ };
85
+ absolutePathToRoutePath(absolutePath: string): string;
86
+ isInDocsDir(absolutePath: string): boolean;
87
+ absolutePathToRelativePath(absolutePath: string): string;
88
+ getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
89
+ }
90
+
91
+ declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData';
92
+
93
+ export { }