@rspress/core 2.0.0-beta.19 → 2.0.0-beta.20

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
@@ -16,6 +16,7 @@ export declare function build(options: BuildOptions): Promise<void>;
16
16
  declare interface BuildOptions {
17
17
  docDirectory: string;
18
18
  config: UserConfig;
19
+ configFilePath: string;
19
20
  }
20
21
 
21
22
  /**
@@ -44,6 +45,7 @@ declare interface DevOptions {
44
45
  appDirectory: string;
45
46
  docDirectory: string;
46
47
  config: UserConfig;
48
+ configFilePath: string;
47
49
  extraBuilderConfig?: RsbuildConfig;
48
50
  }
49
51
 
@@ -92,7 +94,8 @@ declare interface Parent extends Node_2 {
92
94
 
93
95
  declare class PluginDriver {
94
96
  #private;
95
- constructor(config: UserConfig, isProd: boolean);
97
+ constructor(config: UserConfig, configFilePath: string, isProd: boolean);
98
+ getConfigFilePath(): string;
96
99
  init(): Promise<void>;
97
100
  addPlugin(plugin: RspressPlugin): void;
98
101
  getPlugins(): RspressPlugin[];
@@ -200,6 +203,7 @@ export declare function serve(options: ServeOptions): Promise<ReturnType<Rsbuild
200
203
 
201
204
  declare interface ServeOptions {
202
205
  config: UserConfig;
206
+ configFilePath: string;
203
207
  port?: number;
204
208
  host?: string;
205
209
  }
package/dist/index.js CHANGED
@@ -25,13 +25,18 @@ import { visit } from "unist-util-visit";
25
25
  export * from "@rspress/shared";
26
26
  class PluginDriver {
27
27
  #config;
28
+ #configFilePath;
28
29
  #plugins;
29
30
  #isProd;
30
- constructor(config, isProd){
31
+ constructor(config, configFilePath, isProd){
31
32
  this.#config = config;
33
+ this.#configFilePath = configFilePath;
32
34
  this.#isProd = isProd;
33
35
  this.#plugins = [];
34
36
  }
37
+ getConfigFilePath() {
38
+ return this.#configFilePath;
39
+ }
35
40
  async init() {
36
41
  this.clearPlugins();
37
42
  const config = this.#config;
@@ -256,7 +261,7 @@ function normalizePath_slash(p) {
256
261
  function normalizePath(id) {
257
262
  return node_path.posix.normalize(isWindows ? normalizePath_slash(id) : id);
258
263
  }
259
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.19"}');
264
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.20"}');
260
265
  const RSPRESS_VERSION = package_namespaceObject.i8;
261
266
  const constants_isProduction = ()=>'production' === process.env.NODE_ENV;
262
267
  const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
@@ -1861,6 +1866,11 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1861
1866
  }
1862
1867
  },
1863
1868
  performance: {
1869
+ buildCache: {
1870
+ buildDependencies: [
1871
+ pluginDriver.getConfigFilePath()
1872
+ ]
1873
+ },
1864
1874
  chunkSplit: {
1865
1875
  override: {
1866
1876
  cacheGroups: {
@@ -2068,9 +2078,9 @@ async function checkLanguageParity(config) {
2068
2078
  }
2069
2079
  }
2070
2080
  async function dev(options) {
2071
- const { docDirectory, config, extraBuilderConfig } = options;
2081
+ const { docDirectory, config, extraBuilderConfig, configFilePath } = options;
2072
2082
  const isProd = false;
2073
- const pluginDriver = new PluginDriver(config, isProd);
2083
+ const pluginDriver = new PluginDriver(config, configFilePath, isProd);
2074
2084
  await pluginDriver.init();
2075
2085
  const modifiedConfig = await pluginDriver.modifyConfig();
2076
2086
  try {
@@ -2106,8 +2116,8 @@ function emptyDir(path) {
2106
2116
  });
2107
2117
  }
2108
2118
  async function build(options) {
2109
- const { docDirectory, config } = options;
2110
- const pluginDriver = new PluginDriver(config, true);
2119
+ const { docDirectory, config, configFilePath } = options;
2120
+ const pluginDriver = new PluginDriver(config, configFilePath, true);
2111
2121
  await pluginDriver.init();
2112
2122
  const modifiedConfig = await pluginDriver.modifyConfig();
2113
2123
  const ssgConfig = modifiedConfig.ssg ?? true;
@@ -2116,7 +2126,7 @@ async function build(options) {
2116
2126
  if (!ssgConfig) hintSSGFalse();
2117
2127
  }
2118
2128
  async function serve(options) {
2119
- const { config, port: userPort, host: userHost } = options;
2129
+ const { config, port: userPort, host: userHost, configFilePath } = options;
2120
2130
  const envPort = process.env.PORT;
2121
2131
  const envHost = process.env.HOST;
2122
2132
  const { builderConfig } = config;
@@ -2128,7 +2138,7 @@ async function serve(options) {
2128
2138
  host
2129
2139
  }
2130
2140
  });
2131
- const pluginDriver = new PluginDriver(config, true);
2141
+ const pluginDriver = new PluginDriver(config, configFilePath, true);
2132
2142
  await pluginDriver.init();
2133
2143
  const modifiedConfig = await pluginDriver.modifyConfig();
2134
2144
  const rsbuild = await initRsbuild(config.root, modifiedConfig, pluginDriver, false);
package/dist/loader.d.ts CHANGED
@@ -26,7 +26,8 @@ declare interface MdxLoaderOptions {
26
26
 
27
27
  declare class PluginDriver {
28
28
  #private;
29
- constructor(config: UserConfig, isProd: boolean);
29
+ constructor(config: UserConfig, configFilePath: string, isProd: boolean);
30
+ getConfigFilePath(): string;
30
31
  init(): Promise<void>;
31
32
  addPlugin(plugin: RspressPlugin): void;
32
33
  getPlugins(): RspressPlugin[];
@@ -28,7 +28,8 @@ declare interface InitOptions {
28
28
 
29
29
  declare class PluginDriver {
30
30
  #private;
31
- constructor(config: UserConfig, isProd: boolean);
31
+ constructor(config: UserConfig, configFilePath: string, isProd: boolean);
32
+ getConfigFilePath(): string;
32
33
  init(): Promise<void>;
33
34
  addPlugin(plugin: RspressPlugin): void;
34
35
  getPlugins(): RspressPlugin[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.19",
3
+ "version": "2.0.0-beta.20",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -47,12 +47,12 @@
47
47
  "@mdx-js/loader": "^3.1.0",
48
48
  "@mdx-js/mdx": "^3.1.0",
49
49
  "@mdx-js/react": "^3.1.0",
50
- "@rsbuild/core": "~1.4.2",
51
- "@rsbuild/plugin-react": "~1.3.2",
50
+ "@rsbuild/core": "~1.4.3",
51
+ "@rsbuild/plugin-react": "~1.3.3",
52
52
  "@rspress/mdx-rs": "0.6.6",
53
53
  "@shikijs/rehype": "^3.4.2",
54
54
  "@types/unist": "^3.0.3",
55
- "@unhead/react": "^2.0.11",
55
+ "@unhead/react": "^2.0.12",
56
56
  "enhanced-resolve": "5.18.2",
57
57
  "github-slugger": "^2.0.0",
58
58
  "hast-util-from-html": "^2.0.3",
@@ -75,11 +75,11 @@
75
75
  "unified": "^11.0.5",
76
76
  "unist-util-visit": "^5.0.0",
77
77
  "unist-util-visit-children": "^3.0.0",
78
- "@rspress/plugin-last-updated": "2.0.0-beta.19",
79
- "@rspress/shared": "2.0.0-beta.19",
80
- "@rspress/plugin-medium-zoom": "2.0.0-beta.19",
81
- "@rspress/runtime": "2.0.0-beta.19",
82
- "@rspress/theme-default": "2.0.0-beta.19"
78
+ "@rspress/plugin-last-updated": "2.0.0-beta.20",
79
+ "@rspress/plugin-medium-zoom": "2.0.0-beta.20",
80
+ "@rspress/runtime": "2.0.0-beta.20",
81
+ "@rspress/shared": "2.0.0-beta.20",
82
+ "@rspress/theme-default": "2.0.0-beta.20"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@microsoft/api-extractor": "^7.52.8",