@rsbuild/webpack 0.7.7 → 0.7.9
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.cjs +49 -45
- package/dist/index.js +43 -47
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var __publicField = (obj, key, value) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/shared.ts
|
|
42
|
-
var import_core, getChainUtils, initRsbuildConfig, createDevServer,
|
|
42
|
+
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, onCompileDone, TARGET_ID_MAP;
|
|
43
43
|
var init_shared = __esm({
|
|
44
44
|
"src/shared.ts"() {
|
|
45
45
|
"use strict";
|
|
@@ -48,12 +48,15 @@ var init_shared = __esm({
|
|
|
48
48
|
getChainUtils,
|
|
49
49
|
initRsbuildConfig,
|
|
50
50
|
createDevServer,
|
|
51
|
-
startProdServer,
|
|
52
51
|
formatStats,
|
|
53
52
|
getDevMiddleware,
|
|
54
53
|
getStatsOptions,
|
|
55
54
|
stringifyConfig,
|
|
56
|
-
outputInspectConfigFiles
|
|
55
|
+
outputInspectConfigFiles,
|
|
56
|
+
chainToConfig,
|
|
57
|
+
modifyBundlerChain,
|
|
58
|
+
onCompileDone,
|
|
59
|
+
TARGET_ID_MAP
|
|
57
60
|
} = import_core.__internalHelper);
|
|
58
61
|
}
|
|
59
62
|
});
|
|
@@ -131,7 +134,7 @@ var init_inspectConfig = __esm({
|
|
|
131
134
|
|
|
132
135
|
// src/webpackConfig.ts
|
|
133
136
|
async function modifyWebpackChain(context, utils, chain) {
|
|
134
|
-
|
|
137
|
+
import_core2.logger.debug("modify webpack chain");
|
|
135
138
|
const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
|
|
136
139
|
chain,
|
|
137
140
|
utils
|
|
@@ -141,11 +144,11 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
141
144
|
item(modifiedChain, utils);
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
|
-
|
|
147
|
+
import_core2.logger.debug("modify webpack chain done");
|
|
145
148
|
return modifiedChain;
|
|
146
149
|
}
|
|
147
150
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
148
|
-
|
|
151
|
+
import_core2.logger.debug("modify webpack config");
|
|
149
152
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
|
|
150
153
|
webpackConfig,
|
|
151
154
|
utils
|
|
@@ -158,7 +161,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
158
161
|
mergeFn: utils.mergeConfig
|
|
159
162
|
});
|
|
160
163
|
}
|
|
161
|
-
|
|
164
|
+
import_core2.logger.debug("modify webpack config done");
|
|
162
165
|
return modifiedConfig;
|
|
163
166
|
}
|
|
164
167
|
async function getChainUtils2(target) {
|
|
@@ -227,7 +230,7 @@ async function generateWebpackConfig({
|
|
|
227
230
|
ProvidePlugin,
|
|
228
231
|
HotModuleReplacementPlugin
|
|
229
232
|
} = webpack2;
|
|
230
|
-
const bundlerChain = await
|
|
233
|
+
const bundlerChain = await modifyBundlerChain(context, {
|
|
231
234
|
...chainUtils,
|
|
232
235
|
bundler: {
|
|
233
236
|
BannerPlugin,
|
|
@@ -238,7 +241,7 @@ async function generateWebpackConfig({
|
|
|
238
241
|
}
|
|
239
242
|
});
|
|
240
243
|
const chain = await modifyWebpackChain(context, chainUtils, bundlerChain);
|
|
241
|
-
let webpackConfig =
|
|
244
|
+
let webpackConfig = chainToConfig(chain);
|
|
242
245
|
webpackConfig = await modifyWebpackConfig(
|
|
243
246
|
context,
|
|
244
247
|
webpackConfig,
|
|
@@ -270,7 +273,7 @@ async function initConfigs({
|
|
|
270
273
|
const webpackConfigs = await Promise.all(
|
|
271
274
|
targets.map((target) => generateWebpackConfig({ target, context }))
|
|
272
275
|
);
|
|
273
|
-
if (
|
|
276
|
+
if (import_core3.logger.level === "verbose") {
|
|
274
277
|
const inspect = () => {
|
|
275
278
|
const inspectOptions = {
|
|
276
279
|
verbose: true,
|
|
@@ -291,11 +294,11 @@ async function initConfigs({
|
|
|
291
294
|
webpackConfigs
|
|
292
295
|
};
|
|
293
296
|
}
|
|
294
|
-
var
|
|
297
|
+
var import_core3;
|
|
295
298
|
var init_initConfigs = __esm({
|
|
296
299
|
"src/initConfigs.ts"() {
|
|
297
300
|
"use strict";
|
|
298
|
-
|
|
301
|
+
import_core3 = require("@rsbuild/core");
|
|
299
302
|
init_inspectConfig();
|
|
300
303
|
init_shared();
|
|
301
304
|
init_webpackConfig();
|
|
@@ -312,7 +315,7 @@ async function createCompiler({
|
|
|
312
315
|
context,
|
|
313
316
|
webpackConfigs
|
|
314
317
|
}) {
|
|
315
|
-
|
|
318
|
+
import_core4.logger.debug("create compiler");
|
|
316
319
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
317
320
|
bundlerConfigs: webpackConfigs
|
|
318
321
|
});
|
|
@@ -324,12 +327,12 @@ async function createCompiler({
|
|
|
324
327
|
getStatsOptions(compiler)
|
|
325
328
|
);
|
|
326
329
|
if (level === "error") {
|
|
327
|
-
|
|
330
|
+
import_core4.logger.error(message);
|
|
328
331
|
}
|
|
329
332
|
if (level === "warning") {
|
|
330
|
-
|
|
333
|
+
import_core4.logger.warn(message);
|
|
331
334
|
}
|
|
332
|
-
if ((0,
|
|
335
|
+
if ((0, import_shared6.isDev)()) {
|
|
333
336
|
await context.hooks.onDevCompileDone.call({
|
|
334
337
|
isFirstCompile,
|
|
335
338
|
stats
|
|
@@ -338,11 +341,11 @@ async function createCompiler({
|
|
|
338
341
|
isFirstCompile = false;
|
|
339
342
|
};
|
|
340
343
|
let isFirstCompile = true;
|
|
341
|
-
|
|
344
|
+
onCompileDone(compiler, done, import_MultiStats.default);
|
|
342
345
|
await context.hooks.onAfterCreateCompiler.call({
|
|
343
346
|
compiler
|
|
344
347
|
});
|
|
345
|
-
|
|
348
|
+
import_core4.logger.debug("create compiler done");
|
|
346
349
|
return compiler;
|
|
347
350
|
}
|
|
348
351
|
async function createDevMiddleware(options, customCompiler) {
|
|
@@ -361,15 +364,16 @@ async function createDevMiddleware(options, customCompiler) {
|
|
|
361
364
|
compiler
|
|
362
365
|
};
|
|
363
366
|
}
|
|
364
|
-
var
|
|
367
|
+
var import_core4, import_shared6, import_MultiStats;
|
|
365
368
|
var init_createCompiler = __esm({
|
|
366
369
|
"src/createCompiler.ts"() {
|
|
367
370
|
"use strict";
|
|
368
|
-
|
|
369
|
-
|
|
371
|
+
import_core4 = require("@rsbuild/core");
|
|
372
|
+
import_shared6 = require("@rsbuild/shared");
|
|
370
373
|
import_MultiStats = __toESM(require("webpack/lib/MultiStats.js"));
|
|
371
374
|
init_initConfigs();
|
|
372
375
|
init_shared();
|
|
376
|
+
init_shared();
|
|
373
377
|
}
|
|
374
378
|
});
|
|
375
379
|
|
|
@@ -2230,24 +2234,24 @@ function createNonTTYLogger() {
|
|
|
2230
2234
|
}
|
|
2231
2235
|
prevPercentage = 100;
|
|
2232
2236
|
if (hasErrors) {
|
|
2233
|
-
|
|
2237
|
+
import_core5.logger.error(`${id} compile failed in ${compileTime}`);
|
|
2234
2238
|
} else {
|
|
2235
|
-
|
|
2239
|
+
import_core5.logger.ready(`${id} compiled in ${compileTime}`);
|
|
2236
2240
|
}
|
|
2237
2241
|
} else if (current - prevPercentage > 10) {
|
|
2238
2242
|
prevPercentage = current;
|
|
2239
|
-
|
|
2243
|
+
import_core5.logger.info(`${id} compile progress: ${current.toFixed(0)}%`);
|
|
2240
2244
|
}
|
|
2241
2245
|
};
|
|
2242
2246
|
return {
|
|
2243
2247
|
log
|
|
2244
2248
|
};
|
|
2245
2249
|
}
|
|
2246
|
-
var
|
|
2250
|
+
var import_core5;
|
|
2247
2251
|
var init_nonTty = __esm({
|
|
2248
2252
|
"src/progress/helpers/nonTty.ts"() {
|
|
2249
2253
|
"use strict";
|
|
2250
|
-
|
|
2254
|
+
import_core5 = require("@rsbuild/core");
|
|
2251
2255
|
}
|
|
2252
2256
|
});
|
|
2253
2257
|
|
|
@@ -2256,10 +2260,11 @@ var ProgressPlugin_exports = {};
|
|
|
2256
2260
|
__export(ProgressPlugin_exports, {
|
|
2257
2261
|
ProgressPlugin: () => ProgressPlugin
|
|
2258
2262
|
});
|
|
2259
|
-
var import_shared10, import_webpack, ProgressPlugin;
|
|
2263
|
+
var import_core6, import_shared10, import_webpack, ProgressPlugin;
|
|
2260
2264
|
var init_ProgressPlugin = __esm({
|
|
2261
2265
|
"src/progress/ProgressPlugin.ts"() {
|
|
2262
2266
|
"use strict";
|
|
2267
|
+
import_core6 = require("@rsbuild/core");
|
|
2263
2268
|
import_shared10 = require("@rsbuild/shared");
|
|
2264
2269
|
import_webpack = __toESM(require("webpack"));
|
|
2265
2270
|
init_helpers();
|
|
@@ -2322,7 +2327,7 @@ var init_ProgressPlugin = __esm({
|
|
|
2322
2327
|
this.compileTime = (0, import_shared10.prettyTime)(seconds);
|
|
2323
2328
|
startTime = null;
|
|
2324
2329
|
if (!this.hasCompileErrors) {
|
|
2325
|
-
|
|
2330
|
+
import_core6.logger.ready(`${this.id} compiled in ${this.compileTime}`);
|
|
2326
2331
|
}
|
|
2327
2332
|
}
|
|
2328
2333
|
});
|
|
@@ -2353,18 +2358,23 @@ async function applyTsConfigPathsPlugin({
|
|
|
2353
2358
|
}
|
|
2354
2359
|
]);
|
|
2355
2360
|
}
|
|
2361
|
+
function isWebTarget(target) {
|
|
2362
|
+
const targets = (0, import_shared11.castArray)(target);
|
|
2363
|
+
return targets.includes("web") || target.includes("web-worker");
|
|
2364
|
+
}
|
|
2356
2365
|
var import_node_fs, import_shared11, getMainFields, pluginAdaptor;
|
|
2357
2366
|
var init_plugin = __esm({
|
|
2358
2367
|
"src/plugin.ts"() {
|
|
2359
2368
|
"use strict";
|
|
2360
2369
|
import_node_fs = __toESM(require("fs"));
|
|
2361
2370
|
import_shared11 = require("@rsbuild/shared");
|
|
2371
|
+
init_shared();
|
|
2362
2372
|
getMainFields = (chain, target) => {
|
|
2363
2373
|
const mainFields = chain.resolve.mainFields.values();
|
|
2364
2374
|
if (mainFields.length) {
|
|
2365
2375
|
return mainFields;
|
|
2366
2376
|
}
|
|
2367
|
-
if (
|
|
2377
|
+
if (isWebTarget(target)) {
|
|
2368
2378
|
return ["browser", "module", "main"];
|
|
2369
2379
|
}
|
|
2370
2380
|
return ["module", "main"];
|
|
@@ -2388,7 +2398,7 @@ var init_plugin = __esm({
|
|
|
2388
2398
|
const { ProgressPlugin: ProgressPlugin2 } = await Promise.resolve().then(() => (init_ProgressPlugin(), ProgressPlugin_exports));
|
|
2389
2399
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin2, [
|
|
2390
2400
|
{
|
|
2391
|
-
id:
|
|
2401
|
+
id: TARGET_ID_MAP[target],
|
|
2392
2402
|
...progress === true ? {} : progress
|
|
2393
2403
|
}
|
|
2394
2404
|
]);
|
|
@@ -2428,18 +2438,19 @@ var build_exports = {};
|
|
|
2428
2438
|
__export(build_exports, {
|
|
2429
2439
|
build: () => build
|
|
2430
2440
|
});
|
|
2431
|
-
var
|
|
2441
|
+
var import_core7, import_shared13, import_MultiStats2, build;
|
|
2432
2442
|
var init_build = __esm({
|
|
2433
2443
|
"src/build.ts"() {
|
|
2434
2444
|
"use strict";
|
|
2435
|
-
|
|
2436
|
-
|
|
2445
|
+
import_core7 = require("@rsbuild/core");
|
|
2446
|
+
import_shared13 = require("@rsbuild/shared");
|
|
2437
2447
|
import_MultiStats2 = __toESM(require("webpack/lib/MultiStats.js"));
|
|
2438
2448
|
init_createCompiler();
|
|
2439
2449
|
init_initConfigs();
|
|
2450
|
+
init_shared();
|
|
2440
2451
|
build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
|
|
2441
|
-
if (!(0,
|
|
2442
|
-
(0,
|
|
2452
|
+
if (!(0, import_shared13.getNodeEnv)()) {
|
|
2453
|
+
(0, import_shared13.setNodeEnv)(mode);
|
|
2443
2454
|
}
|
|
2444
2455
|
const { context } = initOptions;
|
|
2445
2456
|
let compiler;
|
|
@@ -2463,11 +2474,11 @@ var init_build = __esm({
|
|
|
2463
2474
|
isFirstCompile = false;
|
|
2464
2475
|
await p;
|
|
2465
2476
|
};
|
|
2466
|
-
|
|
2477
|
+
onCompileDone(compiler, onDone, import_MultiStats2.default);
|
|
2467
2478
|
if (watch) {
|
|
2468
2479
|
compiler.watch({}, (err) => {
|
|
2469
2480
|
if (err) {
|
|
2470
|
-
|
|
2481
|
+
import_core7.logger.error(err);
|
|
2471
2482
|
}
|
|
2472
2483
|
});
|
|
2473
2484
|
return;
|
|
@@ -2479,7 +2490,7 @@ var init_build = __esm({
|
|
|
2479
2490
|
reject(buildError);
|
|
2480
2491
|
} else {
|
|
2481
2492
|
compiler.close((closeErr) => {
|
|
2482
|
-
closeErr &&
|
|
2493
|
+
closeErr && import_core7.logger.error(closeErr);
|
|
2483
2494
|
resolve({ stats });
|
|
2484
2495
|
});
|
|
2485
2496
|
}
|
|
@@ -2557,13 +2568,6 @@ var webpackProvider = async ({
|
|
|
2557
2568
|
);
|
|
2558
2569
|
return server.listen();
|
|
2559
2570
|
},
|
|
2560
|
-
async preview(options) {
|
|
2561
|
-
const config = await initRsbuildConfig({
|
|
2562
|
-
context,
|
|
2563
|
-
pluginManager
|
|
2564
|
-
});
|
|
2565
|
-
return startProdServer(context, config, options);
|
|
2566
|
-
},
|
|
2567
2571
|
async build(options) {
|
|
2568
2572
|
const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
|
|
2569
2573
|
return build2({ context, pluginManager, rsbuildOptions }, options);
|
package/dist/index.js
CHANGED
|
@@ -46,18 +46,18 @@ var __publicField = (obj, key, value) => {
|
|
|
46
46
|
return value;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
// ../../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.
|
|
49
|
+
// ../../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.5.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
50
50
|
import { fileURLToPath } from "url";
|
|
51
51
|
import path from "path";
|
|
52
52
|
var init_esm = __esm({
|
|
53
|
-
"../../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.
|
|
53
|
+
"../../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.5.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js"() {
|
|
54
54
|
"use strict";
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
// src/shared.ts
|
|
59
59
|
import { __internalHelper } from "@rsbuild/core";
|
|
60
|
-
var getChainUtils, initRsbuildConfig, createDevServer,
|
|
60
|
+
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, onCompileDone, TARGET_ID_MAP;
|
|
61
61
|
var init_shared = __esm({
|
|
62
62
|
"src/shared.ts"() {
|
|
63
63
|
"use strict";
|
|
@@ -66,12 +66,15 @@ var init_shared = __esm({
|
|
|
66
66
|
getChainUtils,
|
|
67
67
|
initRsbuildConfig,
|
|
68
68
|
createDevServer,
|
|
69
|
-
startProdServer,
|
|
70
69
|
formatStats,
|
|
71
70
|
getDevMiddleware,
|
|
72
71
|
getStatsOptions,
|
|
73
72
|
stringifyConfig,
|
|
74
|
-
outputInspectConfigFiles
|
|
73
|
+
outputInspectConfigFiles,
|
|
74
|
+
chainToConfig,
|
|
75
|
+
modifyBundlerChain,
|
|
76
|
+
onCompileDone,
|
|
77
|
+
TARGET_ID_MAP
|
|
75
78
|
} = __internalHelper);
|
|
76
79
|
}
|
|
77
80
|
});
|
|
@@ -149,17 +152,15 @@ var init_inspectConfig = __esm({
|
|
|
149
152
|
|
|
150
153
|
// src/webpackConfig.ts
|
|
151
154
|
import {
|
|
152
|
-
__internalHelper as __internalHelper2
|
|
155
|
+
__internalHelper as __internalHelper2,
|
|
156
|
+
logger
|
|
153
157
|
} from "@rsbuild/core";
|
|
154
158
|
import {
|
|
155
159
|
castArray,
|
|
156
|
-
chainToConfig,
|
|
157
|
-
debug,
|
|
158
|
-
modifyBundlerChain,
|
|
159
160
|
reduceConfigsWithContext
|
|
160
161
|
} from "@rsbuild/shared";
|
|
161
162
|
async function modifyWebpackChain(context, utils, chain) {
|
|
162
|
-
debug("modify webpack chain");
|
|
163
|
+
logger.debug("modify webpack chain");
|
|
163
164
|
const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
|
|
164
165
|
chain,
|
|
165
166
|
utils
|
|
@@ -169,11 +170,11 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
169
170
|
item(modifiedChain, utils);
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
|
-
debug("modify webpack chain done");
|
|
173
|
+
logger.debug("modify webpack chain done");
|
|
173
174
|
return modifiedChain;
|
|
174
175
|
}
|
|
175
176
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
176
|
-
debug("modify webpack config");
|
|
177
|
+
logger.debug("modify webpack config");
|
|
177
178
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
|
|
178
179
|
webpackConfig,
|
|
179
180
|
utils
|
|
@@ -186,7 +187,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
186
187
|
mergeFn: utils.mergeConfig
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
|
-
debug("modify webpack config done");
|
|
190
|
+
logger.debug("modify webpack config done");
|
|
190
191
|
return modifiedConfig;
|
|
191
192
|
}
|
|
192
193
|
async function getChainUtils2(target) {
|
|
@@ -283,7 +284,9 @@ var init_webpackConfig = __esm({
|
|
|
283
284
|
});
|
|
284
285
|
|
|
285
286
|
// src/initConfigs.ts
|
|
286
|
-
import {
|
|
287
|
+
import {
|
|
288
|
+
logger as logger2
|
|
289
|
+
} from "@rsbuild/core";
|
|
287
290
|
async function initConfigs({
|
|
288
291
|
context,
|
|
289
292
|
pluginManager,
|
|
@@ -297,7 +300,7 @@ async function initConfigs({
|
|
|
297
300
|
const webpackConfigs = await Promise.all(
|
|
298
301
|
targets.map((target) => generateWebpackConfig({ target, context }))
|
|
299
302
|
);
|
|
300
|
-
if (
|
|
303
|
+
if (logger2.level === "verbose") {
|
|
301
304
|
const inspect = () => {
|
|
302
305
|
const inspectOptions = {
|
|
303
306
|
verbose: true,
|
|
@@ -334,18 +337,14 @@ __export(createCompiler_exports, {
|
|
|
334
337
|
createCompiler: () => createCompiler,
|
|
335
338
|
createDevMiddleware: () => createDevMiddleware
|
|
336
339
|
});
|
|
337
|
-
import { logger } from "@rsbuild/core";
|
|
338
|
-
import {
|
|
339
|
-
debug as debug2,
|
|
340
|
-
isDev,
|
|
341
|
-
onCompileDone
|
|
342
|
-
} from "@rsbuild/shared";
|
|
340
|
+
import { logger as logger3 } from "@rsbuild/core";
|
|
341
|
+
import { isDev } from "@rsbuild/shared";
|
|
343
342
|
import WebpackMultiStats from "webpack/lib/MultiStats.js";
|
|
344
343
|
async function createCompiler({
|
|
345
344
|
context,
|
|
346
345
|
webpackConfigs
|
|
347
346
|
}) {
|
|
348
|
-
|
|
347
|
+
logger3.debug("create compiler");
|
|
349
348
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
350
349
|
bundlerConfigs: webpackConfigs
|
|
351
350
|
});
|
|
@@ -357,10 +356,10 @@ async function createCompiler({
|
|
|
357
356
|
getStatsOptions(compiler)
|
|
358
357
|
);
|
|
359
358
|
if (level === "error") {
|
|
360
|
-
|
|
359
|
+
logger3.error(message);
|
|
361
360
|
}
|
|
362
361
|
if (level === "warning") {
|
|
363
|
-
|
|
362
|
+
logger3.warn(message);
|
|
364
363
|
}
|
|
365
364
|
if (isDev()) {
|
|
366
365
|
await context.hooks.onDevCompileDone.call({
|
|
@@ -375,7 +374,7 @@ async function createCompiler({
|
|
|
375
374
|
await context.hooks.onAfterCreateCompiler.call({
|
|
376
375
|
compiler
|
|
377
376
|
});
|
|
378
|
-
|
|
377
|
+
logger3.debug("create compiler done");
|
|
379
378
|
return compiler;
|
|
380
379
|
}
|
|
381
380
|
async function createDevMiddleware(options, customCompiler) {
|
|
@@ -400,6 +399,7 @@ var init_createCompiler = __esm({
|
|
|
400
399
|
init_esm();
|
|
401
400
|
init_initConfigs();
|
|
402
401
|
init_shared();
|
|
402
|
+
init_shared();
|
|
403
403
|
}
|
|
404
404
|
});
|
|
405
405
|
|
|
@@ -2267,7 +2267,7 @@ var init_helpers = __esm({
|
|
|
2267
2267
|
});
|
|
2268
2268
|
|
|
2269
2269
|
// src/progress/helpers/nonTty.ts
|
|
2270
|
-
import { logger as
|
|
2270
|
+
import { logger as logger4 } from "@rsbuild/core";
|
|
2271
2271
|
function createNonTTYLogger() {
|
|
2272
2272
|
let prevPercentage = 0;
|
|
2273
2273
|
const log = ({
|
|
@@ -2283,13 +2283,13 @@ function createNonTTYLogger() {
|
|
|
2283
2283
|
}
|
|
2284
2284
|
prevPercentage = 100;
|
|
2285
2285
|
if (hasErrors) {
|
|
2286
|
-
|
|
2286
|
+
logger4.error(`${id} compile failed in ${compileTime}`);
|
|
2287
2287
|
} else {
|
|
2288
|
-
|
|
2288
|
+
logger4.ready(`${id} compiled in ${compileTime}`);
|
|
2289
2289
|
}
|
|
2290
2290
|
} else if (current - prevPercentage > 10) {
|
|
2291
2291
|
prevPercentage = current;
|
|
2292
|
-
|
|
2292
|
+
logger4.info(`${id} compile progress: ${current.toFixed(0)}%`);
|
|
2293
2293
|
}
|
|
2294
2294
|
};
|
|
2295
2295
|
return {
|
|
@@ -2308,7 +2308,8 @@ var ProgressPlugin_exports = {};
|
|
|
2308
2308
|
__export(ProgressPlugin_exports, {
|
|
2309
2309
|
ProgressPlugin: () => ProgressPlugin
|
|
2310
2310
|
});
|
|
2311
|
-
import { logger as
|
|
2311
|
+
import { logger as logger5 } from "@rsbuild/core";
|
|
2312
|
+
import { prettyTime } from "@rsbuild/shared";
|
|
2312
2313
|
import webpack from "webpack";
|
|
2313
2314
|
var ProgressPlugin;
|
|
2314
2315
|
var init_ProgressPlugin = __esm({
|
|
@@ -2375,7 +2376,7 @@ var init_ProgressPlugin = __esm({
|
|
|
2375
2376
|
this.compileTime = prettyTime(seconds);
|
|
2376
2377
|
startTime = null;
|
|
2377
2378
|
if (!this.hasCompileErrors) {
|
|
2378
|
-
|
|
2379
|
+
logger5.ready(`${this.id} compiled in ${this.compileTime}`);
|
|
2379
2380
|
}
|
|
2380
2381
|
}
|
|
2381
2382
|
});
|
|
@@ -2390,10 +2391,7 @@ __export(plugin_exports, {
|
|
|
2390
2391
|
pluginAdaptor: () => pluginAdaptor
|
|
2391
2392
|
});
|
|
2392
2393
|
import fs from "fs";
|
|
2393
|
-
import {
|
|
2394
|
-
TARGET_ID_MAP,
|
|
2395
|
-
isWebTarget
|
|
2396
|
-
} from "@rsbuild/shared";
|
|
2394
|
+
import { castArray as castArray2 } from "@rsbuild/shared";
|
|
2397
2395
|
async function applyTsConfigPathsPlugin({
|
|
2398
2396
|
chain,
|
|
2399
2397
|
CHAIN_ID,
|
|
@@ -2411,11 +2409,16 @@ async function applyTsConfigPathsPlugin({
|
|
|
2411
2409
|
}
|
|
2412
2410
|
]);
|
|
2413
2411
|
}
|
|
2412
|
+
function isWebTarget(target) {
|
|
2413
|
+
const targets = castArray2(target);
|
|
2414
|
+
return targets.includes("web") || target.includes("web-worker");
|
|
2415
|
+
}
|
|
2414
2416
|
var getMainFields, pluginAdaptor;
|
|
2415
2417
|
var init_plugin = __esm({
|
|
2416
2418
|
"src/plugin.ts"() {
|
|
2417
2419
|
"use strict";
|
|
2418
2420
|
init_esm();
|
|
2421
|
+
init_shared();
|
|
2419
2422
|
getMainFields = (chain, target) => {
|
|
2420
2423
|
const mainFields = chain.resolve.mainFields.values();
|
|
2421
2424
|
if (mainFields.length) {
|
|
@@ -2485,10 +2488,9 @@ var build_exports = {};
|
|
|
2485
2488
|
__export(build_exports, {
|
|
2486
2489
|
build: () => build
|
|
2487
2490
|
});
|
|
2488
|
-
import { logger as
|
|
2491
|
+
import { logger as logger6 } from "@rsbuild/core";
|
|
2489
2492
|
import {
|
|
2490
2493
|
getNodeEnv as getNodeEnv2,
|
|
2491
|
-
onCompileDone as onCompileDone2,
|
|
2492
2494
|
setNodeEnv as setNodeEnv2
|
|
2493
2495
|
} from "@rsbuild/shared";
|
|
2494
2496
|
import WebpackMultiStats2 from "webpack/lib/MultiStats.js";
|
|
@@ -2499,6 +2501,7 @@ var init_build = __esm({
|
|
|
2499
2501
|
init_esm();
|
|
2500
2502
|
init_createCompiler();
|
|
2501
2503
|
init_initConfigs();
|
|
2504
|
+
init_shared();
|
|
2502
2505
|
build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
|
|
2503
2506
|
if (!getNodeEnv2()) {
|
|
2504
2507
|
setNodeEnv2(mode);
|
|
@@ -2525,11 +2528,11 @@ var init_build = __esm({
|
|
|
2525
2528
|
isFirstCompile = false;
|
|
2526
2529
|
await p;
|
|
2527
2530
|
};
|
|
2528
|
-
|
|
2531
|
+
onCompileDone(compiler, onDone, WebpackMultiStats2);
|
|
2529
2532
|
if (watch) {
|
|
2530
2533
|
compiler.watch({}, (err) => {
|
|
2531
2534
|
if (err) {
|
|
2532
|
-
|
|
2535
|
+
logger6.error(err);
|
|
2533
2536
|
}
|
|
2534
2537
|
});
|
|
2535
2538
|
return;
|
|
@@ -2541,7 +2544,7 @@ var init_build = __esm({
|
|
|
2541
2544
|
reject(buildError);
|
|
2542
2545
|
} else {
|
|
2543
2546
|
compiler.close((closeErr) => {
|
|
2544
|
-
closeErr &&
|
|
2547
|
+
closeErr && logger6.error(closeErr);
|
|
2545
2548
|
resolve({ stats });
|
|
2546
2549
|
});
|
|
2547
2550
|
}
|
|
@@ -2616,13 +2619,6 @@ var webpackProvider = async ({
|
|
|
2616
2619
|
);
|
|
2617
2620
|
return server.listen();
|
|
2618
2621
|
},
|
|
2619
|
-
async preview(options) {
|
|
2620
|
-
const config = await initRsbuildConfig({
|
|
2621
|
-
context,
|
|
2622
|
-
pluginManager
|
|
2623
|
-
});
|
|
2624
|
-
return startProdServer(context, config, options);
|
|
2625
|
-
},
|
|
2626
2622
|
async build(options) {
|
|
2627
2623
|
const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
|
|
2628
2624
|
return build2({ context, pluginManager, rsbuildOptions }, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"mini-css-extract-plugin": "2.9.0",
|
|
28
28
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
29
29
|
"webpack": "^5.92.0",
|
|
30
|
-
"@rsbuild/core": "0.7.
|
|
31
|
-
"@rsbuild/shared": "0.7.
|
|
30
|
+
"@rsbuild/core": "0.7.9",
|
|
31
|
+
"@rsbuild/shared": "0.7.9"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "18.x",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"cli-truncate": "2.1.0",
|
|
37
37
|
"patch-console": "1.0.0",
|
|
38
38
|
"typescript": "^5.4.2",
|
|
39
|
-
"@scripts/test-helper": "0.7.
|
|
39
|
+
"@scripts/test-helper": "0.7.9"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|