rspress 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.
Files changed (2) hide show
  1. package/dist/index.js +17 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import chokidar from "chokidar";
6
6
  import picocolors from "picocolors";
7
7
  import node_fs from "node:fs";
8
8
  import { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
9
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.19"}');
9
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.20"}');
10
10
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
11
11
  async function loadConfigFile(customConfigFile) {
12
12
  const baseDir = process.cwd();
@@ -14,14 +14,20 @@ async function loadConfigFile(customConfigFile) {
14
14
  configFilePath = customConfigFile ? node_path.isAbsolute(customConfigFile) ? customConfigFile : node_path.join(baseDir, customConfigFile) : findConfig(node_path.join(baseDir, DEFAULT_CONFIG_NAME));
15
15
  if (!configFilePath) {
16
16
  logger.info(`No config file found in ${baseDir}`);
17
- return {};
17
+ return {
18
+ config: {},
19
+ configFilePath: ''
20
+ };
18
21
  }
19
22
  const { loadConfig } = await import("@rsbuild/core");
20
23
  const { content } = await loadConfig({
21
24
  cwd: node_path.dirname(configFilePath),
22
25
  path: configFilePath
23
26
  });
24
- return content;
27
+ return {
28
+ config: content,
29
+ configFilePath
30
+ };
25
31
  }
26
32
  function resolveDocRoot(cwd, cliRoot, configRoot) {
27
33
  if (cliRoot) return node_path.join(cwd, cliRoot);
@@ -48,13 +54,14 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
48
54
  let devServer;
49
55
  const startDevServer = async ()=>{
50
56
  const { port, host } = options || {};
51
- const config = await loadConfigFile(options?.config);
57
+ const { config, configFilePath } = await loadConfigFile(options?.config);
52
58
  config.root = resolveDocRoot(cwd, root, config.root);
53
59
  const docDirectory = config.root;
54
60
  devServer = await dev({
55
61
  appDirectory: cwd,
56
62
  docDirectory,
57
63
  config,
64
+ configFilePath,
58
65
  extraBuilderConfig: {
59
66
  server: {
60
67
  port,
@@ -101,13 +108,14 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
101
108
  cli.command('build [root]').action(async (root, options)=>{
102
109
  setNodeEnv('production');
103
110
  const cwd = process.cwd();
104
- const config = await loadConfigFile(options.config);
111
+ const { config, configFilePath } = await loadConfigFile(options.config);
105
112
  config.root = resolveDocRoot(cwd, root, config.root);
106
113
  const docDirectory = config.root;
107
114
  try {
108
115
  await build({
109
116
  docDirectory,
110
- config
117
+ config,
118
+ configFilePath
111
119
  });
112
120
  } catch (err) {
113
121
  logger.error(err);
@@ -118,12 +126,13 @@ cli.command('preview [root]').alias('serve').option('--port [port]', 'port numbe
118
126
  setNodeEnv('production');
119
127
  const cwd = process.cwd();
120
128
  const { port, host } = options || {};
121
- const config = await loadConfigFile(options?.config);
129
+ const { config, configFilePath } = await loadConfigFile(options?.config);
122
130
  config.root = resolveDocRoot(cwd, root, config.root);
123
131
  await serve({
124
132
  config,
125
133
  host,
126
- port
134
+ port,
135
+ configFilePath
127
136
  });
128
137
  });
129
138
  cli.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rspress",
3
- "version": "2.0.0-beta.19",
3
+ "version": "2.0.0-beta.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -43,12 +43,12 @@
43
43
  "nav-json-schema.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@rsbuild/core": "~1.4.2",
46
+ "@rsbuild/core": "~1.4.3",
47
47
  "cac": "^6.7.14",
48
48
  "chokidar": "^3.6.0",
49
49
  "picocolors": "^1.1.1",
50
- "@rspress/core": "2.0.0-beta.19",
51
- "@rspress/shared": "2.0.0-beta.19"
50
+ "@rspress/core": "2.0.0-beta.20",
51
+ "@rspress/shared": "2.0.0-beta.20"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@microsoft/api-extractor": "^7.52.8",