@rspress/core 2.0.0-beta.21 → 2.0.0-beta.23
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/bin/rspress.js +15 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +144 -0
- package/dist/index.d.ts +17 -11
- package/dist/index.js +517 -431
- package/dist/index.js.LICENSE.txt +10 -0
- package/dist/loader.d.ts +4 -7
- package/dist/loader.js +3 -4
- package/dist/processor.d.ts +6 -8
- package/dist/processor.js +287 -244
- package/dist/renderPageWorker.js +193 -0
- package/dist/runtime/ssrClientEntry.js +2 -1
- package/dist/runtime/ssrServerEntry.js +2 -2
- package/dist/shiki-transformers.js +14 -14
- package/meta-json-schema.json +382 -0
- package/nav-json-schema.json +118 -0
- package/package.json +20 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://github.com/facebook/docusaurus/blob/0306d182407bb98f140cd5ec7481fa9608fe0297/packages/docusaurus/src/ssg/ssgExecutor.ts#L123
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* these codes are copied from
|
|
8
|
+
* @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
package/dist/loader.d.ts
CHANGED
|
@@ -42,11 +42,6 @@ declare class PluginDriver {
|
|
|
42
42
|
routeGenerated(routes: RouteMeta[]): Promise<void[]>;
|
|
43
43
|
routeServiceGenerated(routeService: RouteService): Promise<void[]>;
|
|
44
44
|
addRuntimeModules(): Promise<Record<string, string>>;
|
|
45
|
-
addSSGRoutes(): Promise<({
|
|
46
|
-
path: string;
|
|
47
|
-
} | {
|
|
48
|
-
path: string;
|
|
49
|
-
})[]>;
|
|
50
45
|
globalUIComponents(): (string | [string, object])[];
|
|
51
46
|
globalStyles(): string[];
|
|
52
47
|
_runParallelAsyncHook<H extends RspressPluginHookKeys>(hookName: H, ...args: Parameters<Required<RspressPlugin>[H]>): Promise<Awaited<ReturnType<Required<RspressPlugin>[H]>>[]>;
|
|
@@ -76,7 +71,8 @@ declare class RouteService {
|
|
|
76
71
|
isExistRoute(routePath: string): boolean;
|
|
77
72
|
generateRoutesCode(): string;
|
|
78
73
|
private generateRoutesCodeByRouteMeta;
|
|
79
|
-
getRoutePathParts(relativePath: string):
|
|
74
|
+
getRoutePathParts(relativePath: string): string[];
|
|
75
|
+
splitRoutePathParts(relativePath: string): readonly [string, string, string];
|
|
80
76
|
normalizeRoutePath(relativePath: string): {
|
|
81
77
|
pureRoutePath: string;
|
|
82
78
|
routePath: string;
|
|
@@ -84,10 +80,11 @@ declare class RouteService {
|
|
|
84
80
|
version: string;
|
|
85
81
|
};
|
|
86
82
|
absolutePathToRoutePath(absolutePath: string): string;
|
|
83
|
+
isInDocsDir(absolutePath: string): boolean;
|
|
87
84
|
absolutePathToRelativePath(absolutePath: string): string;
|
|
88
85
|
getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | '
|
|
88
|
+
declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData';
|
|
92
89
|
|
|
93
90
|
export { }
|
package/dist/loader.js
CHANGED
|
@@ -7,7 +7,7 @@ async function mdxLoader(source) {
|
|
|
7
7
|
const callback = this.async();
|
|
8
8
|
const options = this.getOptions();
|
|
9
9
|
const filepath = this.resourcePath;
|
|
10
|
-
const { config, docDirectory,
|
|
10
|
+
const { config, docDirectory, routeService, pluginDriver } = options;
|
|
11
11
|
const crossCompilerCache = config?.markdown?.crossCompilerCache ?? true;
|
|
12
12
|
try {
|
|
13
13
|
if (crossCompilerCache && 'production' === process.env.NODE_ENV) {
|
|
@@ -15,7 +15,6 @@ async function mdxLoader(source) {
|
|
|
15
15
|
source,
|
|
16
16
|
filepath,
|
|
17
17
|
docDirectory,
|
|
18
|
-
checkDeadLinks,
|
|
19
18
|
config,
|
|
20
19
|
pluginDriver,
|
|
21
20
|
routeService
|
|
@@ -26,10 +25,10 @@ async function mdxLoader(source) {
|
|
|
26
25
|
source,
|
|
27
26
|
filepath,
|
|
28
27
|
docDirectory,
|
|
29
|
-
checkDeadLinks,
|
|
30
28
|
config,
|
|
31
29
|
pluginDriver,
|
|
32
|
-
routeService
|
|
30
|
+
routeService,
|
|
31
|
+
addDependency: this.addDependency
|
|
33
32
|
});
|
|
34
33
|
callback(null, compileResult);
|
|
35
34
|
}
|
package/dist/processor.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AdditionalPage } from '@rspress/shared';
|
|
|
2
2
|
import { DefaultThemeConfig } from '@rspress/shared';
|
|
3
3
|
import type { PageIndexInfo } from '@rspress/shared';
|
|
4
4
|
import type { RouteMeta } from '@rspress/shared';
|
|
5
|
+
import type { Rspack as Rspack_2 } from '@rsbuild/core';
|
|
5
6
|
import type { RspressPlugin } from '@rspress/shared';
|
|
6
7
|
import type { UserConfig } from '@rspress/shared';
|
|
7
8
|
|
|
@@ -10,11 +11,11 @@ export declare function compile(options: CompileOptions): Promise<string>;
|
|
|
10
11
|
declare interface CompileOptions {
|
|
11
12
|
source: string;
|
|
12
13
|
filepath: string;
|
|
13
|
-
checkDeadLinks: boolean;
|
|
14
14
|
docDirectory: string;
|
|
15
15
|
config: UserConfig | null;
|
|
16
16
|
routeService: RouteService | null;
|
|
17
17
|
pluginDriver: PluginDriver | null;
|
|
18
|
+
addDependency?: Rspack_2.LoaderContext['addDependency'];
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export declare function compileWithCrossCompilerCache(options: CompileOptions): Promise<string>;
|
|
@@ -44,11 +45,6 @@ declare class PluginDriver {
|
|
|
44
45
|
routeGenerated(routes: RouteMeta[]): Promise<void[]>;
|
|
45
46
|
routeServiceGenerated(routeService: RouteService): Promise<void[]>;
|
|
46
47
|
addRuntimeModules(): Promise<Record<string, string>>;
|
|
47
|
-
addSSGRoutes(): Promise<({
|
|
48
|
-
path: string;
|
|
49
|
-
} | {
|
|
50
|
-
path: string;
|
|
51
|
-
})[]>;
|
|
52
48
|
globalUIComponents(): (string | [string, object])[];
|
|
53
49
|
globalStyles(): string[];
|
|
54
50
|
_runParallelAsyncHook<H extends RspressPluginHookKeys>(hookName: H, ...args: Parameters<Required<RspressPlugin>[H]>): Promise<Awaited<ReturnType<Required<RspressPlugin>[H]>>[]>;
|
|
@@ -78,7 +74,8 @@ declare class RouteService {
|
|
|
78
74
|
isExistRoute(routePath: string): boolean;
|
|
79
75
|
generateRoutesCode(): string;
|
|
80
76
|
private generateRoutesCodeByRouteMeta;
|
|
81
|
-
getRoutePathParts(relativePath: string):
|
|
77
|
+
getRoutePathParts(relativePath: string): string[];
|
|
78
|
+
splitRoutePathParts(relativePath: string): readonly [string, string, string];
|
|
82
79
|
normalizeRoutePath(relativePath: string): {
|
|
83
80
|
pureRoutePath: string;
|
|
84
81
|
routePath: string;
|
|
@@ -86,10 +83,11 @@ declare class RouteService {
|
|
|
86
83
|
version: string;
|
|
87
84
|
};
|
|
88
85
|
absolutePathToRoutePath(absolutePath: string): string;
|
|
86
|
+
isInDocsDir(absolutePath: string): boolean;
|
|
89
87
|
absolutePathToRelativePath(absolutePath: string): string;
|
|
90
88
|
getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | '
|
|
91
|
+
declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData';
|
|
94
92
|
|
|
95
93
|
export { }
|