@4399ywkf/core 5.0.15 → 5.0.17
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/cli/index.js +23 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +31 -38
- package/dist/index.js +63 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2180,10 +2180,11 @@ function renderBar(percent) {
|
|
|
2180
2180
|
return bar;
|
|
2181
2181
|
}
|
|
2182
2182
|
var DevPrinter = class {
|
|
2183
|
-
constructor(host, port, pluginNames) {
|
|
2183
|
+
constructor(host, port, pluginNames, isBuild = false) {
|
|
2184
2184
|
this.host = host;
|
|
2185
2185
|
this.port = port;
|
|
2186
2186
|
this.pluginNames = pluginNames;
|
|
2187
|
+
this.isBuild = isBuild;
|
|
2187
2188
|
}
|
|
2188
2189
|
startTime = 0;
|
|
2189
2190
|
lastProgressLine = "";
|
|
@@ -2246,7 +2247,11 @@ var DevPrinter = class {
|
|
|
2246
2247
|
const label = chalk.green("ready");
|
|
2247
2248
|
console.log(` ${label} built in ${chalk.bold(`${elapsed} s`)}`);
|
|
2248
2249
|
console.log();
|
|
2249
|
-
this.
|
|
2250
|
+
if (this.isBuild) {
|
|
2251
|
+
this.printPluginList();
|
|
2252
|
+
} else {
|
|
2253
|
+
this.printServerInfo();
|
|
2254
|
+
}
|
|
2250
2255
|
}
|
|
2251
2256
|
/**
|
|
2252
2257
|
* 标记新一轮编译开始(HMR)
|
|
@@ -2256,16 +2261,9 @@ var DevPrinter = class {
|
|
|
2256
2261
|
this.lastProgressLine = "";
|
|
2257
2262
|
}
|
|
2258
2263
|
/**
|
|
2259
|
-
*
|
|
2264
|
+
* 仅打印插件列表(build 模式使用)
|
|
2260
2265
|
*/
|
|
2261
|
-
|
|
2262
|
-
const localUrl = `http://localhost:${this.port}/`;
|
|
2263
|
-
const networkUrl = getNetworkAddress(this.port);
|
|
2264
|
-
console.log(` ${chalk.bold(">")} Local: ${chalk.cyan(localUrl)}`);
|
|
2265
|
-
if (networkUrl) {
|
|
2266
|
-
console.log(` ${chalk.bold(">")} Network: ${chalk.cyan(networkUrl)}`);
|
|
2267
|
-
}
|
|
2268
|
-
console.log();
|
|
2266
|
+
printPluginList() {
|
|
2269
2267
|
if (this.pluginNames.length > 0) {
|
|
2270
2268
|
console.log(` ${chalk.bold(">")} Plugins:`);
|
|
2271
2269
|
for (const name of this.pluginNames) {
|
|
@@ -2274,6 +2272,19 @@ var DevPrinter = class {
|
|
|
2274
2272
|
}
|
|
2275
2273
|
console.log();
|
|
2276
2274
|
}
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* 打印服务器信息面板(dev 模式使用)
|
|
2278
|
+
*/
|
|
2279
|
+
printServerInfo() {
|
|
2280
|
+
const localUrl = `http://localhost:${this.port}/`;
|
|
2281
|
+
const networkUrl = getNetworkAddress(this.port);
|
|
2282
|
+
console.log(` ${chalk.bold(">")} Local: ${chalk.cyan(localUrl)}`);
|
|
2283
|
+
if (networkUrl) {
|
|
2284
|
+
console.log(` ${chalk.bold(">")} Network: ${chalk.cyan(networkUrl)}`);
|
|
2285
|
+
}
|
|
2286
|
+
console.log();
|
|
2287
|
+
this.printPluginList();
|
|
2277
2288
|
console.log(
|
|
2278
2289
|
` ${chalk.bold(">")} press ${chalk.bold("h + enter")} to show shortcuts`
|
|
2279
2290
|
);
|
|
@@ -2482,7 +2493,7 @@ async function build(options = {}) {
|
|
|
2482
2493
|
let rspackConfig = createRspackConfig(config, cwd, { isDev: false });
|
|
2483
2494
|
rspackConfig = await pluginManager.applyRspackConfigHooks(rspackConfig);
|
|
2484
2495
|
const pluginNames = pluginManager.getPluginNames();
|
|
2485
|
-
const printer = new DevPrinter("localhost", 0, pluginNames);
|
|
2496
|
+
const printer = new DevPrinter("localhost", 0, pluginNames, true);
|
|
2486
2497
|
printer.printBanner();
|
|
2487
2498
|
printer.printBuildStart();
|
|
2488
2499
|
printer.updateProgress(0, "preparing");
|