rspress 2.0.0-beta.14 → 2.0.0-beta.16
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.js +14 -14
- package/package.json +6 -5
- package/shiki-transformers.ts +1 -0
package/dist/index.js
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
import
|
1
|
+
import node_path from "node:path";
|
2
2
|
import { build, dev, serve } from "@rspress/core";
|
3
3
|
import { logger } from "@rspress/shared/logger";
|
4
4
|
import { cac } from "cac";
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
5
|
+
import chokidar from "chokidar";
|
6
|
+
import picocolors from "picocolors";
|
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.
|
10
|
-
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(
|
9
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.16"}');
|
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();
|
13
13
|
let configFilePath = '';
|
14
|
-
configFilePath = customConfigFile ?
|
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
17
|
return {};
|
18
18
|
}
|
19
19
|
const { loadConfig } = await import("@rsbuild/core");
|
20
20
|
const { content } = await loadConfig({
|
21
|
-
cwd:
|
21
|
+
cwd: node_path.dirname(configFilePath),
|
22
22
|
path: configFilePath
|
23
23
|
});
|
24
24
|
return content;
|
25
25
|
}
|
26
26
|
function resolveDocRoot(cwd, cliRoot, configRoot) {
|
27
|
-
if (cliRoot) return
|
28
|
-
if (configRoot) return
|
29
|
-
return
|
27
|
+
if (cliRoot) return node_path.join(cwd, cliRoot);
|
28
|
+
if (configRoot) return node_path.isAbsolute(configRoot) ? configRoot : node_path.join(cwd, configRoot);
|
29
|
+
return node_path.join(cwd, 'docs');
|
30
30
|
}
|
31
31
|
const CONFIG_FILES = [
|
32
32
|
'rspress.config.ts',
|
@@ -62,7 +62,7 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
});
|
65
|
-
cliWatcher =
|
65
|
+
cliWatcher = chokidar.watch([
|
66
66
|
`${cwd}/**/{${CONFIG_FILES.join(',')}}`,
|
67
67
|
docDirectory
|
68
68
|
], {
|
@@ -74,11 +74,11 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
|
|
74
74
|
]
|
75
75
|
});
|
76
76
|
cliWatcher.on('all', async (eventName, filepath)=>{
|
77
|
-
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && (CONFIG_FILES.includes(
|
77
|
+
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && (CONFIG_FILES.includes(node_path.basename(filepath)) || node_path.basename(filepath) === META_FILE)) {
|
78
78
|
if (isRestarting) return;
|
79
79
|
isRestarting = true;
|
80
80
|
console.log(`
|
81
|
-
\u{2728} ${eventName} ${
|
81
|
+
\u{2728} ${eventName} ${picocolors.green(node_path.relative(cwd, filepath))}, dev server will restart...\n`);
|
82
82
|
await devServer.close();
|
83
83
|
await cliWatcher.close();
|
84
84
|
await startDevServer();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rspress",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.16",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
@@ -37,6 +37,7 @@
|
|
37
37
|
"runtime.ts",
|
38
38
|
"theme.ts",
|
39
39
|
"config.ts",
|
40
|
+
"shiki-transformers.ts",
|
40
41
|
"meta-json-schema.json"
|
41
42
|
],
|
42
43
|
"dependencies": {
|
@@ -44,15 +45,15 @@
|
|
44
45
|
"cac": "^6.7.14",
|
45
46
|
"chokidar": "^3.6.0",
|
46
47
|
"picocolors": "^1.1.1",
|
47
|
-
"@rspress/core": "2.0.0-beta.
|
48
|
-
"@rspress/shared": "2.0.0-beta.
|
48
|
+
"@rspress/core": "2.0.0-beta.16",
|
49
|
+
"@rspress/shared": "2.0.0-beta.16"
|
49
50
|
},
|
50
51
|
"devDependencies": {
|
51
52
|
"@microsoft/api-extractor": "^7.52.8",
|
52
|
-
"@rslib/core": "0.
|
53
|
+
"@rslib/core": "0.10.0",
|
53
54
|
"@types/jest": "~29.5.14",
|
54
55
|
"@types/node": "^22.8.1",
|
55
|
-
"@types/react": "^19.1.
|
56
|
+
"@types/react": "^19.1.8",
|
56
57
|
"rimraf": "^6.0.1",
|
57
58
|
"rsbuild-plugin-publint": "^0.3.2",
|
58
59
|
"ts-json-schema-generator": "^2.4.0",
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@rspress/core/shiki-transformers';
|