rspress 1.40.0 → 1.40.1
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 +27 -27
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import * as
|
2
|
-
import * as
|
3
|
-
import * as
|
4
|
-
import * as
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_core_1b2e46ce__ from "@rspress/core";
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_cac__ from "cac";
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_chalk__ from "chalk";
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_chokidar__ from "chokidar";
|
8
|
-
import * as
|
9
|
-
import * as
|
10
|
-
import * as
|
11
|
-
import * as
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_fs_extra_006a0330__ from "@rspress/shared/fs-extra";
|
12
12
|
const DEFAULT_CONFIG_NAME = 'rspress.config';
|
13
13
|
const DEFAULT_EXTENSIONS = [
|
14
14
|
'.js',
|
@@ -18,26 +18,26 @@ const DEFAULT_EXTENSIONS = [
|
|
18
18
|
'.cjs',
|
19
19
|
'.cts'
|
20
20
|
];
|
21
|
-
const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(
|
21
|
+
const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync);
|
22
22
|
async function loadConfigFile(customConfigFile) {
|
23
23
|
const baseDir = process.cwd();
|
24
24
|
let configFilePath = '';
|
25
|
-
configFilePath = customConfigFile ?
|
25
|
+
configFilePath = customConfigFile ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(customConfigFile) ? customConfigFile : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(baseDir, customConfigFile) : findConfig(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(baseDir, DEFAULT_CONFIG_NAME));
|
26
26
|
if (!configFilePath) {
|
27
|
-
|
27
|
+
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info(`No config file found in ${baseDir}`);
|
28
28
|
return {};
|
29
29
|
}
|
30
30
|
const { loadConfig } = await import("@rsbuild/core");
|
31
31
|
const { content } = await loadConfig({
|
32
|
-
cwd:
|
32
|
+
cwd: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(configFilePath),
|
33
33
|
path: configFilePath
|
34
34
|
});
|
35
35
|
return content;
|
36
36
|
}
|
37
37
|
function resolveDocRoot(cwd, cliRoot, configRoot) {
|
38
|
-
if (cliRoot) return
|
39
|
-
if (configRoot) return
|
40
|
-
return
|
38
|
+
if (cliRoot) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, cliRoot);
|
39
|
+
if (configRoot) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(configRoot) ? configRoot : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, configRoot);
|
40
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'docs');
|
41
41
|
}
|
42
42
|
const lockfileMap = {
|
43
43
|
'package-lock.json': 'npm',
|
@@ -47,14 +47,14 @@ const lockfileMap = {
|
|
47
47
|
};
|
48
48
|
async function getPackageManager(rootPath) {
|
49
49
|
let packageManager = 'npm';
|
50
|
-
for (const file of Object.keys(lockfileMap))if (await (0,
|
50
|
+
for (const file of Object.keys(lockfileMap))if (await (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_fs_extra_006a0330__.pathExists)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, file))) {
|
51
51
|
packageManager = lockfileMap[file];
|
52
52
|
break;
|
53
53
|
}
|
54
54
|
return packageManager;
|
55
55
|
}
|
56
56
|
async function getRspressDependencies(rootPath) {
|
57
|
-
const packageJson = JSON.parse(await
|
57
|
+
const packageJson = JSON.parse(await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, 'package.json'), {
|
58
58
|
encoding: 'utf-8'
|
59
59
|
}));
|
60
60
|
const dependencies = packageJson?.dependencies ? Object.keys(packageJson.dependencies) : [];
|
@@ -65,10 +65,10 @@ async function update() {
|
|
65
65
|
const cwd = process.cwd();
|
66
66
|
const packageManager = await getPackageManager(cwd);
|
67
67
|
const rspressDependencies = await getRspressDependencies(cwd);
|
68
|
-
|
68
|
+
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.greet(`Using ${packageManager} to update ${rspressDependencies.join(' ')}`);
|
69
69
|
if ('npm' === packageManager || 'bun' === packageManager) {
|
70
70
|
const dependencies = rspressDependencies.map((item)=>`${item}@latest`);
|
71
|
-
(0,
|
71
|
+
(0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.spawn)(packageManager, [
|
72
72
|
'install',
|
73
73
|
'--save',
|
74
74
|
...dependencies
|
@@ -77,7 +77,7 @@ async function update() {
|
|
77
77
|
});
|
78
78
|
} else {
|
79
79
|
const subCommand = 'yarn' === packageManager ? 'upgrade' : 'update';
|
80
|
-
(0,
|
80
|
+
(0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.spawn)(packageManager, [
|
81
81
|
subCommand,
|
82
82
|
'--latest',
|
83
83
|
...rspressDependencies
|
@@ -92,11 +92,11 @@ const CONFIG_FILES = [
|
|
92
92
|
'i18n.json'
|
93
93
|
];
|
94
94
|
const META_FILE = '_meta.json';
|
95
|
-
const src_require = (0,
|
95
|
+
const src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
96
96
|
const src_packageJson = src_require('../package.json');
|
97
97
|
const cli = (0, __WEBPACK_EXTERNAL_MODULE_cac__.cac)('rspress').version(src_packageJson.version).help();
|
98
98
|
const landingMessage = `🔥 Rspress v${src_packageJson.version}\n`;
|
99
|
-
|
99
|
+
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.greet(landingMessage);
|
100
100
|
const setNodeEnv = (env)=>{
|
101
101
|
process.env.NODE_ENV = env;
|
102
102
|
};
|
@@ -112,7 +112,7 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
|
|
112
112
|
const config = await loadConfigFile(options?.config);
|
113
113
|
config.root = resolveDocRoot(cwd, root, config.root);
|
114
114
|
const docDirectory = config.root;
|
115
|
-
devServer = await (0,
|
115
|
+
devServer = await (0, __WEBPACK_EXTERNAL_MODULE__rspress_core_1b2e46ce__.dev)({
|
116
116
|
appDirectory: cwd,
|
117
117
|
docDirectory,
|
118
118
|
config,
|
@@ -135,10 +135,10 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
|
|
135
135
|
]
|
136
136
|
});
|
137
137
|
cliWatcher.on('all', async (eventName, filepath)=>{
|
138
|
-
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && (CONFIG_FILES.includes(
|
138
|
+
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && (CONFIG_FILES.includes(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath)) || __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath) === META_FILE)) {
|
139
139
|
if (isRestarting) return;
|
140
140
|
isRestarting = true;
|
141
|
-
console.log(`\n✨ ${eventName} ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(
|
141
|
+
console.log(`\n✨ ${eventName} ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(cwd, filepath))}, dev server will restart...\n`);
|
142
142
|
await devServer.close();
|
143
143
|
await cliWatcher.close();
|
144
144
|
await startDevServer();
|
@@ -164,7 +164,7 @@ cli.command('build [root]').action(async (root, options)=>{
|
|
164
164
|
const config = await loadConfigFile(options.config);
|
165
165
|
config.root = resolveDocRoot(cwd, root, config.root);
|
166
166
|
const docDirectory = config.root;
|
167
|
-
await (0,
|
167
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__rspress_core_1b2e46ce__.build)({
|
168
168
|
appDirectory: cwd,
|
169
169
|
docDirectory,
|
170
170
|
config
|
@@ -176,7 +176,7 @@ cli.command('preview [root]').alias('serve').option('--port [port]', 'port numbe
|
|
176
176
|
const { port, host } = options || {};
|
177
177
|
const config = await loadConfigFile(options?.config);
|
178
178
|
config.root = resolveDocRoot(cwd, root, config.root);
|
179
|
-
await (0,
|
179
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__rspress_core_1b2e46ce__.serve)({
|
180
180
|
config,
|
181
181
|
host,
|
182
182
|
port
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rspress",
|
3
|
-
"version": "1.40.
|
3
|
+
"version": "1.40.1",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/web-infra-dev/rspress",
|
@@ -36,16 +36,16 @@
|
|
36
36
|
"config.ts"
|
37
37
|
],
|
38
38
|
"dependencies": {
|
39
|
-
"@rsbuild/core": "
|
39
|
+
"@rsbuild/core": "1.2.0",
|
40
40
|
"cac": "^6.7.14",
|
41
41
|
"chalk": "5.4.1",
|
42
42
|
"chokidar": "^3.6.0",
|
43
|
-
"@rspress/
|
44
|
-
"@rspress/
|
43
|
+
"@rspress/core": "1.40.1",
|
44
|
+
"@rspress/shared": "1.40.1"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@microsoft/api-extractor": "^7.49.1",
|
48
|
-
"@rslib/core": "0.
|
48
|
+
"@rslib/core": "0.3.2",
|
49
49
|
"@types/jest": "~29.5.14",
|
50
50
|
"@types/node": "^18.11.17",
|
51
51
|
"@types/react": "^18.3.18",
|