@rsbuild/webpack 1.0.1-beta.8 → 1.0.1-rc.0
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 +48 -74
- package/dist/index.js +50 -76
- package/dist-types/build.d.ts +4 -2
- package/dist-types/createCompiler.d.ts +2 -8
- package/dist-types/shared.d.ts +14 -3
- package/package.json +5 -5
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, formatStats,
|
|
42
|
+
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, registerDevHook, registerBuildHook, prettyTime, castArray;
|
|
43
43
|
var init_shared = __esm({
|
|
44
44
|
"src/shared.ts"() {
|
|
45
45
|
"use strict";
|
|
@@ -49,14 +49,14 @@ var init_shared = __esm({
|
|
|
49
49
|
initRsbuildConfig,
|
|
50
50
|
createDevServer,
|
|
51
51
|
formatStats,
|
|
52
|
-
getDevMiddleware,
|
|
53
52
|
getStatsOptions,
|
|
54
53
|
stringifyConfig,
|
|
55
54
|
outputInspectConfigFiles,
|
|
56
55
|
getRsbuildInspectConfig,
|
|
57
56
|
chainToConfig,
|
|
58
57
|
modifyBundlerChain,
|
|
59
|
-
|
|
58
|
+
registerDevHook,
|
|
59
|
+
registerBuildHook,
|
|
60
60
|
prettyTime
|
|
61
61
|
} = import_core.__internalHelper);
|
|
62
62
|
castArray = (arr) => {
|
|
@@ -80,8 +80,8 @@ async function inspectConfig({
|
|
|
80
80
|
bundlerConfigs,
|
|
81
81
|
inspectOptions = {}
|
|
82
82
|
}) {
|
|
83
|
-
if (inspectOptions.
|
|
84
|
-
process.env.NODE_ENV = inspectOptions.
|
|
83
|
+
if (inspectOptions.mode) {
|
|
84
|
+
process.env.NODE_ENV = inspectOptions.mode;
|
|
85
85
|
} else if (!process.env.NODE_ENV) {
|
|
86
86
|
process.env.NODE_ENV = "development";
|
|
87
87
|
}
|
|
@@ -141,7 +141,7 @@ var init_inspectConfig = __esm({
|
|
|
141
141
|
}
|
|
142
142
|
return (0, import_node_path.join)(context.distPath, inspectOptions.outputPath);
|
|
143
143
|
}
|
|
144
|
-
return context.distPath;
|
|
144
|
+
return (0, import_node_path.join)(context.distPath, ".rsbuild");
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
});
|
|
@@ -275,7 +275,11 @@ async function initConfigs({
|
|
|
275
275
|
bundlerConfigs: webpackConfigs
|
|
276
276
|
});
|
|
277
277
|
};
|
|
278
|
-
context.hooks.onBeforeBuild.tap(
|
|
278
|
+
context.hooks.onBeforeBuild.tap(({ isFirstCompile }) => {
|
|
279
|
+
if (isFirstCompile) {
|
|
280
|
+
inspect();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
279
283
|
context.hooks.onAfterStartDevServer.tap(inspect);
|
|
280
284
|
}
|
|
281
285
|
return {
|
|
@@ -296,21 +300,19 @@ var init_initConfigs = __esm({
|
|
|
296
300
|
// src/createCompiler.ts
|
|
297
301
|
var createCompiler_exports = {};
|
|
298
302
|
__export(createCompiler_exports, {
|
|
299
|
-
createCompiler: () => createCompiler
|
|
300
|
-
createDevMiddleware: () => createDevMiddleware
|
|
303
|
+
createCompiler: () => createCompiler
|
|
301
304
|
});
|
|
302
|
-
async function createCompiler({
|
|
303
|
-
context,
|
|
304
|
-
webpackConfigs
|
|
305
|
-
}) {
|
|
305
|
+
async function createCompiler(options) {
|
|
306
306
|
import_core4.logger.debug("create compiler");
|
|
307
|
+
const { context } = options;
|
|
308
|
+
const { webpackConfigs } = await initConfigs(options);
|
|
307
309
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
308
310
|
bundlerConfigs: webpackConfigs,
|
|
309
311
|
environments: context.environments
|
|
310
312
|
});
|
|
311
313
|
const { default: webpack2 } = await import("webpack");
|
|
312
314
|
const compiler = webpackConfigs.length === 1 ? webpack2(webpackConfigs[0]) : webpack2(webpackConfigs);
|
|
313
|
-
const done =
|
|
315
|
+
const done = (stats) => {
|
|
314
316
|
const { message, level } = formatStats(
|
|
315
317
|
stats,
|
|
316
318
|
getStatsOptions(compiler)
|
|
@@ -321,38 +323,26 @@ async function createCompiler({
|
|
|
321
323
|
if (level === "warning") {
|
|
322
324
|
import_core4.logger.warn(message);
|
|
323
325
|
}
|
|
324
|
-
if (process.env.NODE_ENV === "development") {
|
|
325
|
-
await context.hooks.onDevCompileDone.call({
|
|
326
|
-
isFirstCompile,
|
|
327
|
-
stats,
|
|
328
|
-
environments: context.environments
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
isFirstCompile = false;
|
|
332
326
|
};
|
|
333
|
-
|
|
334
|
-
|
|
327
|
+
compiler.hooks.done.tap("rsbuild:done", (stats) => {
|
|
328
|
+
done(stats);
|
|
329
|
+
});
|
|
330
|
+
if (context.normalizedConfig?.mode === "development") {
|
|
331
|
+
registerDevHook({
|
|
332
|
+
compiler,
|
|
333
|
+
context,
|
|
334
|
+
bundlerConfigs: webpackConfigs,
|
|
335
|
+
MultiStatsCtor: import_MultiStats.default
|
|
336
|
+
});
|
|
337
|
+
}
|
|
335
338
|
await context.hooks.onAfterCreateCompiler.call({
|
|
336
339
|
compiler,
|
|
337
340
|
environments: context.environments
|
|
338
341
|
});
|
|
339
342
|
import_core4.logger.debug("create compiler done");
|
|
340
|
-
return compiler;
|
|
341
|
-
}
|
|
342
|
-
async function createDevMiddleware(options, customCompiler) {
|
|
343
|
-
let compiler;
|
|
344
|
-
if (customCompiler) {
|
|
345
|
-
compiler = customCompiler;
|
|
346
|
-
} else {
|
|
347
|
-
const { webpackConfigs } = await initConfigs(options);
|
|
348
|
-
compiler = await createCompiler({
|
|
349
|
-
context: options.context,
|
|
350
|
-
webpackConfigs
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
343
|
return {
|
|
354
|
-
|
|
355
|
-
|
|
344
|
+
compiler,
|
|
345
|
+
webpackConfigs
|
|
356
346
|
};
|
|
357
347
|
}
|
|
358
348
|
var import_core4, import_MultiStats;
|
|
@@ -363,7 +353,6 @@ var init_createCompiler = __esm({
|
|
|
363
353
|
import_MultiStats = __toESM(require("webpack/lib/MultiStats.js"));
|
|
364
354
|
init_initConfigs();
|
|
365
355
|
init_shared();
|
|
366
|
-
init_shared();
|
|
367
356
|
}
|
|
368
357
|
});
|
|
369
358
|
|
|
@@ -2438,49 +2427,36 @@ var init_build = __esm({
|
|
|
2438
2427
|
import_core7 = require("@rsbuild/core");
|
|
2439
2428
|
import_MultiStats2 = __toESM(require("webpack/lib/MultiStats.js"));
|
|
2440
2429
|
init_createCompiler();
|
|
2441
|
-
init_initConfigs();
|
|
2442
2430
|
init_shared();
|
|
2443
|
-
build = async (initOptions, {
|
|
2444
|
-
if (!process.env.NODE_ENV) {
|
|
2445
|
-
process.env.NODE_ENV = mode;
|
|
2446
|
-
}
|
|
2431
|
+
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
2447
2432
|
const { context } = initOptions;
|
|
2448
2433
|
let compiler;
|
|
2449
2434
|
let bundlerConfigs;
|
|
2450
2435
|
if (customCompiler) {
|
|
2451
2436
|
compiler = customCompiler;
|
|
2452
2437
|
} else {
|
|
2453
|
-
const
|
|
2454
|
-
compiler =
|
|
2455
|
-
|
|
2456
|
-
webpackConfigs
|
|
2457
|
-
});
|
|
2458
|
-
bundlerConfigs = webpackConfigs;
|
|
2438
|
+
const result = await createCompiler(initOptions);
|
|
2439
|
+
compiler = result.compiler;
|
|
2440
|
+
bundlerConfigs = result.webpackConfigs;
|
|
2459
2441
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2442
|
+
registerBuildHook({
|
|
2443
|
+
context,
|
|
2462
2444
|
bundlerConfigs,
|
|
2463
|
-
|
|
2464
|
-
isWatch: Boolean(watch)
|
|
2445
|
+
compiler,
|
|
2446
|
+
isWatch: Boolean(watch),
|
|
2447
|
+
MultiStatsCtor: import_MultiStats2.default
|
|
2465
2448
|
});
|
|
2466
|
-
const onDone = async (stats) => {
|
|
2467
|
-
const p = context.hooks.onAfterBuild.call({
|
|
2468
|
-
isFirstCompile,
|
|
2469
|
-
stats,
|
|
2470
|
-
environments: context.environments,
|
|
2471
|
-
isWatch: Boolean(watch)
|
|
2472
|
-
});
|
|
2473
|
-
isFirstCompile = false;
|
|
2474
|
-
await p;
|
|
2475
|
-
};
|
|
2476
|
-
onCompileDone(compiler, onDone, import_MultiStats2.default);
|
|
2477
2449
|
if (watch) {
|
|
2478
|
-
compiler.watch({}, (err) => {
|
|
2450
|
+
const watching = compiler.watch({}, (err) => {
|
|
2479
2451
|
if (err) {
|
|
2480
2452
|
import_core7.logger.error(err);
|
|
2481
2453
|
}
|
|
2482
2454
|
});
|
|
2483
|
-
return
|
|
2455
|
+
return {
|
|
2456
|
+
close: () => new Promise((resolve) => {
|
|
2457
|
+
watching.close(resolve);
|
|
2458
|
+
})
|
|
2459
|
+
};
|
|
2484
2460
|
}
|
|
2485
2461
|
await new Promise(
|
|
2486
2462
|
(resolve, reject) => {
|
|
@@ -2521,12 +2497,12 @@ var webpackProvider = async ({
|
|
|
2521
2497
|
setCssExtractPlugin(cssExtractPlugin);
|
|
2522
2498
|
const createCompiler2 = async () => {
|
|
2523
2499
|
const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2524
|
-
const
|
|
2500
|
+
const result = await createCompiler3({
|
|
2525
2501
|
context,
|
|
2526
2502
|
pluginManager,
|
|
2527
2503
|
rsbuildOptions
|
|
2528
2504
|
});
|
|
2529
|
-
return
|
|
2505
|
+
return result.compiler;
|
|
2530
2506
|
};
|
|
2531
2507
|
const { pluginAdaptor: pluginAdaptor2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
|
|
2532
2508
|
pluginManager.addPlugins([pluginAdaptor2()]);
|
|
@@ -2542,17 +2518,15 @@ var webpackProvider = async ({
|
|
|
2542
2518
|
return webpackConfigs;
|
|
2543
2519
|
},
|
|
2544
2520
|
async createDevServer(options) {
|
|
2545
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2546
2521
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
2547
2522
|
return createDevServer(
|
|
2548
2523
|
{ context, pluginManager, rsbuildOptions },
|
|
2549
|
-
|
|
2524
|
+
createCompiler2,
|
|
2550
2525
|
config,
|
|
2551
2526
|
options
|
|
2552
2527
|
);
|
|
2553
2528
|
},
|
|
2554
2529
|
async startDevServer(options) {
|
|
2555
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2556
2530
|
const config = await initRsbuildConfig({
|
|
2557
2531
|
context,
|
|
2558
2532
|
pluginManager
|
|
@@ -2563,7 +2537,7 @@ var webpackProvider = async ({
|
|
|
2563
2537
|
pluginManager,
|
|
2564
2538
|
rsbuildOptions
|
|
2565
2539
|
},
|
|
2566
|
-
|
|
2540
|
+
createCompiler2,
|
|
2567
2541
|
config,
|
|
2568
2542
|
options
|
|
2569
2543
|
);
|
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.
|
|
49
|
+
// ../../../node_modules/.pnpm/@modern-js+module-tools@2.58.2_typescript@5.5.2/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.
|
|
53
|
+
"../../../node_modules/.pnpm/@modern-js+module-tools@2.58.2_typescript@5.5.2/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, formatStats,
|
|
60
|
+
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, registerDevHook, registerBuildHook, prettyTime, castArray;
|
|
61
61
|
var init_shared = __esm({
|
|
62
62
|
"src/shared.ts"() {
|
|
63
63
|
"use strict";
|
|
@@ -67,14 +67,14 @@ var init_shared = __esm({
|
|
|
67
67
|
initRsbuildConfig,
|
|
68
68
|
createDevServer,
|
|
69
69
|
formatStats,
|
|
70
|
-
getDevMiddleware,
|
|
71
70
|
getStatsOptions,
|
|
72
71
|
stringifyConfig,
|
|
73
72
|
outputInspectConfigFiles,
|
|
74
73
|
getRsbuildInspectConfig,
|
|
75
74
|
chainToConfig,
|
|
76
75
|
modifyBundlerChain,
|
|
77
|
-
|
|
76
|
+
registerDevHook,
|
|
77
|
+
registerBuildHook,
|
|
78
78
|
prettyTime
|
|
79
79
|
} = __internalHelper);
|
|
80
80
|
castArray = (arr) => {
|
|
@@ -99,8 +99,8 @@ async function inspectConfig({
|
|
|
99
99
|
bundlerConfigs,
|
|
100
100
|
inspectOptions = {}
|
|
101
101
|
}) {
|
|
102
|
-
if (inspectOptions.
|
|
103
|
-
process.env.NODE_ENV = inspectOptions.
|
|
102
|
+
if (inspectOptions.mode) {
|
|
103
|
+
process.env.NODE_ENV = inspectOptions.mode;
|
|
104
104
|
} else if (!process.env.NODE_ENV) {
|
|
105
105
|
process.env.NODE_ENV = "development";
|
|
106
106
|
}
|
|
@@ -160,7 +160,7 @@ var init_inspectConfig = __esm({
|
|
|
160
160
|
}
|
|
161
161
|
return join(context.distPath, inspectOptions.outputPath);
|
|
162
162
|
}
|
|
163
|
-
return context.distPath;
|
|
163
|
+
return join(context.distPath, ".rsbuild");
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
});
|
|
@@ -300,7 +300,11 @@ async function initConfigs({
|
|
|
300
300
|
bundlerConfigs: webpackConfigs
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
|
-
context.hooks.onBeforeBuild.tap(
|
|
303
|
+
context.hooks.onBeforeBuild.tap(({ isFirstCompile }) => {
|
|
304
|
+
if (isFirstCompile) {
|
|
305
|
+
inspect();
|
|
306
|
+
}
|
|
307
|
+
});
|
|
304
308
|
context.hooks.onAfterStartDevServer.tap(inspect);
|
|
305
309
|
}
|
|
306
310
|
return {
|
|
@@ -320,23 +324,21 @@ var init_initConfigs = __esm({
|
|
|
320
324
|
// src/createCompiler.ts
|
|
321
325
|
var createCompiler_exports = {};
|
|
322
326
|
__export(createCompiler_exports, {
|
|
323
|
-
createCompiler: () => createCompiler
|
|
324
|
-
createDevMiddleware: () => createDevMiddleware
|
|
327
|
+
createCompiler: () => createCompiler
|
|
325
328
|
});
|
|
326
329
|
import { logger as logger3 } from "@rsbuild/core";
|
|
327
330
|
import WebpackMultiStats from "webpack/lib/MultiStats.js";
|
|
328
|
-
async function createCompiler({
|
|
329
|
-
context,
|
|
330
|
-
webpackConfigs
|
|
331
|
-
}) {
|
|
331
|
+
async function createCompiler(options) {
|
|
332
332
|
logger3.debug("create compiler");
|
|
333
|
+
const { context } = options;
|
|
334
|
+
const { webpackConfigs } = await initConfigs(options);
|
|
333
335
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
334
336
|
bundlerConfigs: webpackConfigs,
|
|
335
337
|
environments: context.environments
|
|
336
338
|
});
|
|
337
339
|
const { default: webpack2 } = await import("webpack");
|
|
338
340
|
const compiler = webpackConfigs.length === 1 ? webpack2(webpackConfigs[0]) : webpack2(webpackConfigs);
|
|
339
|
-
const done =
|
|
341
|
+
const done = (stats) => {
|
|
340
342
|
const { message, level } = formatStats(
|
|
341
343
|
stats,
|
|
342
344
|
getStatsOptions(compiler)
|
|
@@ -347,38 +349,26 @@ async function createCompiler({
|
|
|
347
349
|
if (level === "warning") {
|
|
348
350
|
logger3.warn(message);
|
|
349
351
|
}
|
|
350
|
-
if (process.env.NODE_ENV === "development") {
|
|
351
|
-
await context.hooks.onDevCompileDone.call({
|
|
352
|
-
isFirstCompile,
|
|
353
|
-
stats,
|
|
354
|
-
environments: context.environments
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
isFirstCompile = false;
|
|
358
352
|
};
|
|
359
|
-
|
|
360
|
-
|
|
353
|
+
compiler.hooks.done.tap("rsbuild:done", (stats) => {
|
|
354
|
+
done(stats);
|
|
355
|
+
});
|
|
356
|
+
if (context.normalizedConfig?.mode === "development") {
|
|
357
|
+
registerDevHook({
|
|
358
|
+
compiler,
|
|
359
|
+
context,
|
|
360
|
+
bundlerConfigs: webpackConfigs,
|
|
361
|
+
MultiStatsCtor: WebpackMultiStats
|
|
362
|
+
});
|
|
363
|
+
}
|
|
361
364
|
await context.hooks.onAfterCreateCompiler.call({
|
|
362
365
|
compiler,
|
|
363
366
|
environments: context.environments
|
|
364
367
|
});
|
|
365
368
|
logger3.debug("create compiler done");
|
|
366
|
-
return compiler;
|
|
367
|
-
}
|
|
368
|
-
async function createDevMiddleware(options, customCompiler) {
|
|
369
|
-
let compiler;
|
|
370
|
-
if (customCompiler) {
|
|
371
|
-
compiler = customCompiler;
|
|
372
|
-
} else {
|
|
373
|
-
const { webpackConfigs } = await initConfigs(options);
|
|
374
|
-
compiler = await createCompiler({
|
|
375
|
-
context: options.context,
|
|
376
|
-
webpackConfigs
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
369
|
return {
|
|
380
|
-
|
|
381
|
-
|
|
370
|
+
compiler,
|
|
371
|
+
webpackConfigs
|
|
382
372
|
};
|
|
383
373
|
}
|
|
384
374
|
var init_createCompiler = __esm({
|
|
@@ -387,7 +377,6 @@ var init_createCompiler = __esm({
|
|
|
387
377
|
init_esm();
|
|
388
378
|
init_initConfigs();
|
|
389
379
|
init_shared();
|
|
390
|
-
init_shared();
|
|
391
380
|
}
|
|
392
381
|
});
|
|
393
382
|
|
|
@@ -2487,49 +2476,36 @@ var init_build = __esm({
|
|
|
2487
2476
|
"use strict";
|
|
2488
2477
|
init_esm();
|
|
2489
2478
|
init_createCompiler();
|
|
2490
|
-
init_initConfigs();
|
|
2491
2479
|
init_shared();
|
|
2492
|
-
build = async (initOptions, {
|
|
2493
|
-
if (!process.env.NODE_ENV) {
|
|
2494
|
-
process.env.NODE_ENV = mode;
|
|
2495
|
-
}
|
|
2480
|
+
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
2496
2481
|
const { context } = initOptions;
|
|
2497
2482
|
let compiler;
|
|
2498
2483
|
let bundlerConfigs;
|
|
2499
2484
|
if (customCompiler) {
|
|
2500
2485
|
compiler = customCompiler;
|
|
2501
2486
|
} else {
|
|
2502
|
-
const
|
|
2503
|
-
compiler =
|
|
2504
|
-
|
|
2505
|
-
webpackConfigs
|
|
2506
|
-
});
|
|
2507
|
-
bundlerConfigs = webpackConfigs;
|
|
2487
|
+
const result = await createCompiler(initOptions);
|
|
2488
|
+
compiler = result.compiler;
|
|
2489
|
+
bundlerConfigs = result.webpackConfigs;
|
|
2508
2490
|
}
|
|
2509
|
-
|
|
2510
|
-
|
|
2491
|
+
registerBuildHook({
|
|
2492
|
+
context,
|
|
2511
2493
|
bundlerConfigs,
|
|
2512
|
-
|
|
2513
|
-
isWatch: Boolean(watch)
|
|
2494
|
+
compiler,
|
|
2495
|
+
isWatch: Boolean(watch),
|
|
2496
|
+
MultiStatsCtor: WebpackMultiStats2
|
|
2514
2497
|
});
|
|
2515
|
-
const onDone = async (stats) => {
|
|
2516
|
-
const p = context.hooks.onAfterBuild.call({
|
|
2517
|
-
isFirstCompile,
|
|
2518
|
-
stats,
|
|
2519
|
-
environments: context.environments,
|
|
2520
|
-
isWatch: Boolean(watch)
|
|
2521
|
-
});
|
|
2522
|
-
isFirstCompile = false;
|
|
2523
|
-
await p;
|
|
2524
|
-
};
|
|
2525
|
-
onCompileDone(compiler, onDone, WebpackMultiStats2);
|
|
2526
2498
|
if (watch) {
|
|
2527
|
-
compiler.watch({}, (err) => {
|
|
2499
|
+
const watching = compiler.watch({}, (err) => {
|
|
2528
2500
|
if (err) {
|
|
2529
2501
|
logger6.error(err);
|
|
2530
2502
|
}
|
|
2531
2503
|
});
|
|
2532
|
-
return
|
|
2504
|
+
return {
|
|
2505
|
+
close: () => new Promise((resolve) => {
|
|
2506
|
+
watching.close(resolve);
|
|
2507
|
+
})
|
|
2508
|
+
};
|
|
2533
2509
|
}
|
|
2534
2510
|
await new Promise(
|
|
2535
2511
|
(resolve, reject) => {
|
|
@@ -2567,12 +2543,12 @@ var webpackProvider = async ({
|
|
|
2567
2543
|
setCssExtractPlugin(cssExtractPlugin);
|
|
2568
2544
|
const createCompiler2 = async () => {
|
|
2569
2545
|
const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2570
|
-
const
|
|
2546
|
+
const result = await createCompiler3({
|
|
2571
2547
|
context,
|
|
2572
2548
|
pluginManager,
|
|
2573
2549
|
rsbuildOptions
|
|
2574
2550
|
});
|
|
2575
|
-
return
|
|
2551
|
+
return result.compiler;
|
|
2576
2552
|
};
|
|
2577
2553
|
const { pluginAdaptor: pluginAdaptor2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
|
|
2578
2554
|
pluginManager.addPlugins([pluginAdaptor2()]);
|
|
@@ -2588,17 +2564,15 @@ var webpackProvider = async ({
|
|
|
2588
2564
|
return webpackConfigs;
|
|
2589
2565
|
},
|
|
2590
2566
|
async createDevServer(options) {
|
|
2591
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2592
2567
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
2593
2568
|
return createDevServer(
|
|
2594
2569
|
{ context, pluginManager, rsbuildOptions },
|
|
2595
|
-
|
|
2570
|
+
createCompiler2,
|
|
2596
2571
|
config,
|
|
2597
2572
|
options
|
|
2598
2573
|
);
|
|
2599
2574
|
},
|
|
2600
2575
|
async startDevServer(options) {
|
|
2601
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2602
2576
|
const config = await initRsbuildConfig({
|
|
2603
2577
|
context,
|
|
2604
2578
|
pluginManager
|
|
@@ -2609,7 +2583,7 @@ var webpackProvider = async ({
|
|
|
2609
2583
|
pluginManager,
|
|
2610
2584
|
rsbuildOptions
|
|
2611
2585
|
},
|
|
2612
|
-
|
|
2586
|
+
createCompiler2,
|
|
2613
2587
|
config,
|
|
2614
2588
|
options
|
|
2615
2589
|
);
|
package/dist-types/build.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { BuildOptions } from '@rsbuild/core';
|
|
2
|
-
import {
|
|
3
|
-
export declare const build: (initOptions: InitConfigsOptions, {
|
|
2
|
+
import type { InitConfigsOptions } from './initConfigs';
|
|
3
|
+
export declare const build: (initOptions: InitConfigsOptions, { watch, compiler: customCompiler }?: BuildOptions) => Promise<void | {
|
|
4
|
+
close: () => Promise<void>;
|
|
5
|
+
}>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { type Rspack } from '@rsbuild/core';
|
|
2
2
|
import { type InitConfigsOptions } from './initConfigs';
|
|
3
|
-
|
|
4
|
-
import type { WebpackConfig } from './types';
|
|
5
|
-
export declare function createCompiler({ context, webpackConfigs, }: {
|
|
6
|
-
context: InternalContext;
|
|
7
|
-
webpackConfigs: WebpackConfig[];
|
|
8
|
-
}): Promise<Rspack.Compiler | Rspack.MultiCompiler>;
|
|
9
|
-
export declare function createDevMiddleware(options: InitConfigsOptions, customCompiler?: Rspack.Compiler | Rspack.MultiCompiler): Promise<{
|
|
10
|
-
devMiddleware: import("node_modules/@rsbuild/core/dist-types/server/devMiddleware").DevMiddleware;
|
|
3
|
+
export declare function createCompiler(options: InitConfigsOptions): Promise<{
|
|
11
4
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
5
|
+
webpackConfigs: import("webpack").Configuration[];
|
|
12
6
|
}>;
|
package/dist-types/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __internalHelper } from '@rsbuild/core';
|
|
2
|
-
declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildConfig: typeof __internalHelper.initRsbuildConfig, createDevServer: typeof __internalHelper.createDevServer, formatStats: typeof __internalHelper.formatStats,
|
|
2
|
+
declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildConfig: typeof __internalHelper.initRsbuildConfig, createDevServer: typeof __internalHelper.createDevServer, formatStats: typeof __internalHelper.formatStats, getStatsOptions: typeof __internalHelper.getStatsOptions, stringifyConfig: typeof __internalHelper.stringifyConfig, outputInspectConfigFiles: typeof __internalHelper.outputInspectConfigFiles, getRsbuildInspectConfig: ({ normalizedConfig, inspectOptions, pluginManager, }: {
|
|
3
3
|
normalizedConfig: import("@rsbuild/core").NormalizedConfig;
|
|
4
4
|
inspectOptions: import("@rsbuild/core").InspectConfigOptions;
|
|
5
5
|
pluginManager: import("@rsbuild/core").PluginManager;
|
|
@@ -11,7 +11,18 @@ declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildC
|
|
|
11
11
|
content: string;
|
|
12
12
|
}>;
|
|
13
13
|
environmentConfigs: import("@rsbuild/core").InspectConfigResult["origin"]["environmentConfigs"];
|
|
14
|
-
}, chainToConfig: typeof __internalHelper.chainToConfig, modifyBundlerChain: typeof __internalHelper.modifyBundlerChain,
|
|
15
|
-
|
|
14
|
+
}, chainToConfig: typeof __internalHelper.chainToConfig, modifyBundlerChain: typeof __internalHelper.modifyBundlerChain, registerDevHook: ({ context, compiler, bundlerConfigs, MultiStatsCtor, }: {
|
|
15
|
+
bundlerConfigs?: import("@rspack/core").Configuration[];
|
|
16
|
+
context: __internalHelper.InternalContext;
|
|
17
|
+
compiler: import("@rspack/core").Compiler | import("@rspack/core").MultiCompiler;
|
|
18
|
+
MultiStatsCtor: new (stats: import("@rspack/core").Stats[]) => import("@rspack/core").MultiStats;
|
|
19
|
+
}) => void, registerBuildHook: ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor, }: {
|
|
20
|
+
bundlerConfigs?: import("@rspack/core").Configuration[];
|
|
21
|
+
context: __internalHelper.InternalContext;
|
|
22
|
+
compiler: import("@rspack/core").Compiler | import("@rspack/core").MultiCompiler;
|
|
23
|
+
isWatch: boolean;
|
|
24
|
+
MultiStatsCtor: new (stats: import("@rspack/core").Stats[]) => import("@rspack/core").MultiStats;
|
|
25
|
+
}) => void, prettyTime: (seconds: number) => string;
|
|
26
|
+
export { getChainUtils, initRsbuildConfig, createDevServer, formatStats, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, registerDevHook, registerBuildHook, prettyTime, getRsbuildInspectConfig, };
|
|
16
27
|
export type InternalContext = __internalHelper.InternalContext;
|
|
17
28
|
export declare const castArray: <T>(arr?: T | T[]) => T[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "1.0.1-
|
|
3
|
+
"version": "1.0.1-rc.0",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"copy-webpack-plugin": "11.0.0",
|
|
28
|
-
"mini-css-extract-plugin": "2.9.
|
|
28
|
+
"mini-css-extract-plugin": "2.9.1",
|
|
29
29
|
"picocolors": "^1.0.1",
|
|
30
30
|
"reduce-configs": "^1.0.0",
|
|
31
31
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
32
|
-
"webpack": "^5.
|
|
33
|
-
"@rsbuild/core": "1.0.1-
|
|
32
|
+
"webpack": "^5.94.0",
|
|
33
|
+
"@rsbuild/core": "1.0.1-rc.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "18.x",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"cli-truncate": "2.1.0",
|
|
39
39
|
"patch-console": "1.0.0",
|
|
40
40
|
"typescript": "^5.5.2",
|
|
41
|
-
"@scripts/test-helper": "1.0.1-
|
|
41
|
+
"@scripts/test-helper": "1.0.1-rc.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|