@rspress/core 2.0.0-beta.33 → 2.0.0-beta.35

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/loader.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AdditionalPage } from '@rspress/shared';
2
2
  import { DefaultThemeConfig } from '@rspress/shared';
3
- import type { PageIndexInfo } from '@rspress/shared';
3
+ import { PageIndexInfo } from '@rspress/shared';
4
4
  import { RouteMeta } from '@rspress/shared';
5
5
  import { Rspack as Rspack_2 } from '@rsbuild/core';
6
- import type { RspressPlugin } from '@rspress/shared';
6
+ import { RspressPlugin } from '@rspress/shared';
7
7
  import { UserConfig } from '@rspress/shared';
8
8
 
9
9
  declare interface InitOptions {
@@ -21,6 +21,10 @@ declare interface MdxLoaderOptions {
21
21
  checkDeadLinks: boolean;
22
22
  routeService: RouteService;
23
23
  pluginDriver: PluginDriver;
24
+ /**
25
+ * @default false
26
+ */
27
+ isSsgMd?: boolean;
24
28
  }
25
29
 
26
30
  declare class PluginDriver {
@@ -34,6 +38,7 @@ declare class PluginDriver {
34
38
  getPlugins(): RspressPlugin[];
35
39
  clearPlugins(): void;
36
40
  removePlugin(pluginName: string): void;
41
+ private normalizeConfig;
37
42
  modifyConfig(): Promise<UserConfig<DefaultThemeConfig>>;
38
43
  beforeBuild(): Promise<void[]>;
39
44
  afterBuild(): Promise<void[]>;
@@ -85,6 +90,9 @@ declare class RouteService {
85
90
  isInDocsDir(absolutePath: string): boolean;
86
91
  absolutePathToRelativePath(absolutePath: string): string;
87
92
  getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
93
+ getDocsDir(): string;
94
+ getLangs(): string[];
95
+ getDefaultLang(): string;
88
96
  }
89
97
 
90
98
  declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData';
package/dist/loader.js CHANGED
@@ -5,10 +5,10 @@ async function mdxLoader(source) {
5
5
  const callback = this.async();
6
6
  const options = this.getOptions();
7
7
  const filepath = this.resourcePath;
8
- const { config, docDirectory, routeService, pluginDriver } = options;
8
+ const { config, docDirectory, routeService, pluginDriver, isSsgMd = false } = options;
9
9
  const crossCompilerCache = config?.markdown?.crossCompilerCache ?? true;
10
10
  try {
11
- if (crossCompilerCache && 'production' === process.env.NODE_ENV) {
11
+ if (crossCompilerCache && 'production' === process.env.NODE_ENV && !isSsgMd) {
12
12
  const compileResult = await compileWithCrossCompilerCache({
13
13
  source,
14
14
  filepath,
@@ -26,7 +26,8 @@ async function mdxLoader(source) {
26
26
  config,
27
27
  pluginDriver,
28
28
  routeService,
29
- addDependency: this.addDependency
29
+ addDependency: this.addDependency,
30
+ isSsgMd
30
31
  });
31
32
  callback(null, compileResult);
32
33
  }
@@ -1,9 +1,9 @@
1
1
  import { AdditionalPage } from '@rspress/shared';
2
2
  import { DefaultThemeConfig } from '@rspress/shared';
3
- import type { PageIndexInfo } from '@rspress/shared';
3
+ import { PageIndexInfo } from '@rspress/shared';
4
4
  import { RouteMeta } from '@rspress/shared';
5
5
  import type { Rspack as Rspack_2 } from '@rsbuild/core';
6
- import type { RspressPlugin } from '@rspress/shared';
6
+ import { RspressPlugin } from '@rspress/shared';
7
7
  import { UserConfig } from '@rspress/shared';
8
8
 
9
9
  export declare function compile(options: CompileOptions): Promise<string>;
@@ -16,6 +16,10 @@ declare interface CompileOptions {
16
16
  routeService: RouteService | null;
17
17
  pluginDriver: PluginDriver | null;
18
18
  addDependency?: Rspack_2.LoaderContext['addDependency'];
19
+ /**
20
+ * @default false
21
+ */
22
+ isSsgMd?: boolean;
19
23
  }
20
24
 
21
25
  export declare function compileWithCrossCompilerCache(options: CompileOptions): Promise<string>;
@@ -37,6 +41,7 @@ declare class PluginDriver {
37
41
  getPlugins(): RspressPlugin[];
38
42
  clearPlugins(): void;
39
43
  removePlugin(pluginName: string): void;
44
+ private normalizeConfig;
40
45
  modifyConfig(): Promise<UserConfig<DefaultThemeConfig>>;
41
46
  beforeBuild(): Promise<void[]>;
42
47
  afterBuild(): Promise<void[]>;
@@ -88,6 +93,9 @@ declare class RouteService {
88
93
  isInDocsDir(absolutePath: string): boolean;
89
94
  absolutePathToRelativePath(absolutePath: string): string;
90
95
  getRoutePageByRoutePath(routePath: string): RoutePage | undefined;
96
+ getDocsDir(): string;
97
+ getLangs(): string[];
98
+ getDefaultLang(): string;
91
99
  }
92
100
 
93
101
  declare type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData';