rspress 1.0.0-beta.5 → 1.0.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 -29
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -55,11 +55,7 @@ async function loadConfigFile(customConfigFile) {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
// src/index.ts
|
58
|
-
var CONFIG_FILES = [
|
59
|
-
"rspress.config.ts",
|
60
|
-
"rspress.config.js",
|
61
|
-
"_meta.json"
|
62
|
-
];
|
58
|
+
var CONFIG_FILES = ["rspress.config.ts", "rspress.config.js", "_meta.json"];
|
63
59
|
var require2 = createRequire2(import.meta.url);
|
64
60
|
var packageJson = require2("../package.json");
|
65
61
|
var cli = cac("rspress").version(packageJson.version).help();
|
@@ -90,22 +86,22 @@ cli.command("[root]", "start dev server").alias("dev").action(async (root, optio
|
|
90
86
|
docDirectory,
|
91
87
|
config
|
92
88
|
});
|
93
|
-
cliWatcher = chokidar.watch(
|
94
|
-
`${cwd}/**/{${CONFIG_FILES.join(",")}}`,
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
"**/.git/**",
|
101
|
-
"**/.DS_Store/**"
|
102
|
-
]
|
103
|
-
});
|
89
|
+
cliWatcher = chokidar.watch(
|
90
|
+
[`${cwd}/**/{${CONFIG_FILES.join(",")}}`, docDirectory],
|
91
|
+
{
|
92
|
+
ignoreInitial: true,
|
93
|
+
ignored: ["**/node_modules/**", "**/.git/**", "**/.DS_Store/**"]
|
94
|
+
}
|
95
|
+
);
|
104
96
|
cliWatcher.on("all", async (eventName, filepath) => {
|
105
97
|
if (eventName === "add" || eventName === "unlink" || eventName === "change" && CONFIG_FILES.includes(path2.basename(filepath))) {
|
106
|
-
console.log(
|
107
|
-
|
108
|
-
|
98
|
+
console.log(
|
99
|
+
`
|
100
|
+
✨ ${eventName} ${chalk.green(
|
101
|
+
path2.relative(cwd, filepath)
|
102
|
+
)}, dev server will restart...
|
103
|
+
`
|
104
|
+
);
|
109
105
|
await devServer.close();
|
110
106
|
await cliWatcher.close();
|
111
107
|
await startDevServer();
|
@@ -133,14 +129,16 @@ cli.command("build [root]").option("-c --config <config>", "specify config file"
|
|
133
129
|
config
|
134
130
|
});
|
135
131
|
});
|
136
|
-
cli.command("preview").alias("serve").option("-c --config <config>", "specify config file").option("--port [port]", "port number").option("--host [host]", "hostname").action(
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
});
|
132
|
+
cli.command("preview").alias("serve").option("-c --config <config>", "specify config file").option("--port [port]", "port number").option("--host [host]", "hostname").action(
|
133
|
+
async (options) => {
|
134
|
+
setNodeEnv("production");
|
135
|
+
const { port, host } = options || {};
|
136
|
+
const config = await loadConfigFile(options?.config);
|
137
|
+
await serve({
|
138
|
+
config,
|
139
|
+
host,
|
140
|
+
port
|
141
|
+
});
|
142
|
+
}
|
143
|
+
);
|
146
144
|
cli.parse();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rspress",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
4
|
"type": "module",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"main": "./dist/index.js",
|
@@ -28,12 +28,12 @@
|
|
28
28
|
}
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@modern-js/node-bundle-require": "2.
|
31
|
+
"@modern-js/node-bundle-require": "2.36.0",
|
32
32
|
"cac": "^6.7.14",
|
33
33
|
"chokidar": "^3.5.3",
|
34
34
|
"chalk": "5.3.0",
|
35
|
-
"@rspress/core": "1.0.
|
36
|
-
"@rspress/shared": "1.0.
|
35
|
+
"@rspress/core": "1.0.1",
|
36
|
+
"@rspress/shared": "1.0.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@types/jest": "~29.2.4",
|