@rsbuild/webpack 1.0.1-beta.15 → 1.0.1-beta.16
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 +14 -39
- package/dist/index.js +14 -39
- package/dist-types/build.d.ts +1 -1
- package/dist-types/createCompiler.d.ts +2 -8
- package/dist-types/shared.d.ts +2 -2
- package/package.json +3 -3
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,7 +49,6 @@ var init_shared = __esm({
|
|
|
49
49
|
initRsbuildConfig,
|
|
50
50
|
createDevServer,
|
|
51
51
|
formatStats,
|
|
52
|
-
getDevMiddleware,
|
|
53
52
|
getStatsOptions,
|
|
54
53
|
stringifyConfig,
|
|
55
54
|
outputInspectConfigFiles,
|
|
@@ -301,14 +300,12 @@ var init_initConfigs = __esm({
|
|
|
301
300
|
// src/createCompiler.ts
|
|
302
301
|
var createCompiler_exports = {};
|
|
303
302
|
__export(createCompiler_exports, {
|
|
304
|
-
createCompiler: () => createCompiler
|
|
305
|
-
createDevMiddleware: () => createDevMiddleware
|
|
303
|
+
createCompiler: () => createCompiler
|
|
306
304
|
});
|
|
307
|
-
async function createCompiler({
|
|
308
|
-
context,
|
|
309
|
-
webpackConfigs
|
|
310
|
-
}) {
|
|
305
|
+
async function createCompiler(options) {
|
|
311
306
|
import_core4.logger.debug("create compiler");
|
|
307
|
+
const { context } = options;
|
|
308
|
+
const { webpackConfigs } = await initConfigs(options);
|
|
312
309
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
313
310
|
bundlerConfigs: webpackConfigs,
|
|
314
311
|
environments: context.environments
|
|
@@ -343,22 +340,9 @@ async function createCompiler({
|
|
|
343
340
|
environments: context.environments
|
|
344
341
|
});
|
|
345
342
|
import_core4.logger.debug("create compiler done");
|
|
346
|
-
return compiler;
|
|
347
|
-
}
|
|
348
|
-
async function createDevMiddleware(options, customCompiler) {
|
|
349
|
-
let compiler;
|
|
350
|
-
if (customCompiler) {
|
|
351
|
-
compiler = customCompiler;
|
|
352
|
-
} else {
|
|
353
|
-
const { webpackConfigs } = await initConfigs(options);
|
|
354
|
-
compiler = await createCompiler({
|
|
355
|
-
context: options.context,
|
|
356
|
-
webpackConfigs
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
343
|
return {
|
|
360
|
-
|
|
361
|
-
|
|
344
|
+
compiler,
|
|
345
|
+
webpackConfigs
|
|
362
346
|
};
|
|
363
347
|
}
|
|
364
348
|
var import_core4, import_MultiStats;
|
|
@@ -2443,24 +2427,17 @@ var init_build = __esm({
|
|
|
2443
2427
|
import_core7 = require("@rsbuild/core");
|
|
2444
2428
|
import_MultiStats2 = __toESM(require("webpack/lib/MultiStats.js"));
|
|
2445
2429
|
init_createCompiler();
|
|
2446
|
-
init_initConfigs();
|
|
2447
2430
|
init_shared();
|
|
2448
2431
|
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
2449
|
-
if (!process.env.NODE_ENV) {
|
|
2450
|
-
process.env.NODE_ENV = "production";
|
|
2451
|
-
}
|
|
2452
2432
|
const { context } = initOptions;
|
|
2453
2433
|
let compiler;
|
|
2454
2434
|
let bundlerConfigs;
|
|
2455
2435
|
if (customCompiler) {
|
|
2456
2436
|
compiler = customCompiler;
|
|
2457
2437
|
} else {
|
|
2458
|
-
const
|
|
2459
|
-
compiler =
|
|
2460
|
-
|
|
2461
|
-
webpackConfigs
|
|
2462
|
-
});
|
|
2463
|
-
bundlerConfigs = webpackConfigs;
|
|
2438
|
+
const result = await createCompiler(initOptions);
|
|
2439
|
+
compiler = result.compiler;
|
|
2440
|
+
bundlerConfigs = result.webpackConfigs;
|
|
2464
2441
|
}
|
|
2465
2442
|
registerBuildHook({
|
|
2466
2443
|
context,
|
|
@@ -2520,12 +2497,12 @@ var webpackProvider = async ({
|
|
|
2520
2497
|
setCssExtractPlugin(cssExtractPlugin);
|
|
2521
2498
|
const createCompiler2 = async () => {
|
|
2522
2499
|
const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2523
|
-
const
|
|
2500
|
+
const result = await createCompiler3({
|
|
2524
2501
|
context,
|
|
2525
2502
|
pluginManager,
|
|
2526
2503
|
rsbuildOptions
|
|
2527
2504
|
});
|
|
2528
|
-
return
|
|
2505
|
+
return result.compiler;
|
|
2529
2506
|
};
|
|
2530
2507
|
const { pluginAdaptor: pluginAdaptor2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
|
|
2531
2508
|
pluginManager.addPlugins([pluginAdaptor2()]);
|
|
@@ -2541,17 +2518,15 @@ var webpackProvider = async ({
|
|
|
2541
2518
|
return webpackConfigs;
|
|
2542
2519
|
},
|
|
2543
2520
|
async createDevServer(options) {
|
|
2544
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2545
2521
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
2546
2522
|
return createDevServer(
|
|
2547
2523
|
{ context, pluginManager, rsbuildOptions },
|
|
2548
|
-
|
|
2524
|
+
createCompiler2,
|
|
2549
2525
|
config,
|
|
2550
2526
|
options
|
|
2551
2527
|
);
|
|
2552
2528
|
},
|
|
2553
2529
|
async startDevServer(options) {
|
|
2554
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2555
2530
|
const config = await initRsbuildConfig({
|
|
2556
2531
|
context,
|
|
2557
2532
|
pluginManager
|
|
@@ -2562,7 +2537,7 @@ var webpackProvider = async ({
|
|
|
2562
2537
|
pluginManager,
|
|
2563
2538
|
rsbuildOptions
|
|
2564
2539
|
},
|
|
2565
|
-
|
|
2540
|
+
createCompiler2,
|
|
2566
2541
|
config,
|
|
2567
2542
|
options
|
|
2568
2543
|
);
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var init_esm = __esm({
|
|
|
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,7 +67,6 @@ var init_shared = __esm({
|
|
|
67
67
|
initRsbuildConfig,
|
|
68
68
|
createDevServer,
|
|
69
69
|
formatStats,
|
|
70
|
-
getDevMiddleware,
|
|
71
70
|
getStatsOptions,
|
|
72
71
|
stringifyConfig,
|
|
73
72
|
outputInspectConfigFiles,
|
|
@@ -325,16 +324,14 @@ var init_initConfigs = __esm({
|
|
|
325
324
|
// src/createCompiler.ts
|
|
326
325
|
var createCompiler_exports = {};
|
|
327
326
|
__export(createCompiler_exports, {
|
|
328
|
-
createCompiler: () => createCompiler
|
|
329
|
-
createDevMiddleware: () => createDevMiddleware
|
|
327
|
+
createCompiler: () => createCompiler
|
|
330
328
|
});
|
|
331
329
|
import { logger as logger3 } from "@rsbuild/core";
|
|
332
330
|
import WebpackMultiStats from "webpack/lib/MultiStats.js";
|
|
333
|
-
async function createCompiler({
|
|
334
|
-
context,
|
|
335
|
-
webpackConfigs
|
|
336
|
-
}) {
|
|
331
|
+
async function createCompiler(options) {
|
|
337
332
|
logger3.debug("create compiler");
|
|
333
|
+
const { context } = options;
|
|
334
|
+
const { webpackConfigs } = await initConfigs(options);
|
|
338
335
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
339
336
|
bundlerConfigs: webpackConfigs,
|
|
340
337
|
environments: context.environments
|
|
@@ -369,22 +366,9 @@ async function createCompiler({
|
|
|
369
366
|
environments: context.environments
|
|
370
367
|
});
|
|
371
368
|
logger3.debug("create compiler done");
|
|
372
|
-
return compiler;
|
|
373
|
-
}
|
|
374
|
-
async function createDevMiddleware(options, customCompiler) {
|
|
375
|
-
let compiler;
|
|
376
|
-
if (customCompiler) {
|
|
377
|
-
compiler = customCompiler;
|
|
378
|
-
} else {
|
|
379
|
-
const { webpackConfigs } = await initConfigs(options);
|
|
380
|
-
compiler = await createCompiler({
|
|
381
|
-
context: options.context,
|
|
382
|
-
webpackConfigs
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
369
|
return {
|
|
386
|
-
|
|
387
|
-
|
|
370
|
+
compiler,
|
|
371
|
+
webpackConfigs
|
|
388
372
|
};
|
|
389
373
|
}
|
|
390
374
|
var init_createCompiler = __esm({
|
|
@@ -2492,24 +2476,17 @@ var init_build = __esm({
|
|
|
2492
2476
|
"use strict";
|
|
2493
2477
|
init_esm();
|
|
2494
2478
|
init_createCompiler();
|
|
2495
|
-
init_initConfigs();
|
|
2496
2479
|
init_shared();
|
|
2497
2480
|
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
2498
|
-
if (!process.env.NODE_ENV) {
|
|
2499
|
-
process.env.NODE_ENV = "production";
|
|
2500
|
-
}
|
|
2501
2481
|
const { context } = initOptions;
|
|
2502
2482
|
let compiler;
|
|
2503
2483
|
let bundlerConfigs;
|
|
2504
2484
|
if (customCompiler) {
|
|
2505
2485
|
compiler = customCompiler;
|
|
2506
2486
|
} else {
|
|
2507
|
-
const
|
|
2508
|
-
compiler =
|
|
2509
|
-
|
|
2510
|
-
webpackConfigs
|
|
2511
|
-
});
|
|
2512
|
-
bundlerConfigs = webpackConfigs;
|
|
2487
|
+
const result = await createCompiler(initOptions);
|
|
2488
|
+
compiler = result.compiler;
|
|
2489
|
+
bundlerConfigs = result.webpackConfigs;
|
|
2513
2490
|
}
|
|
2514
2491
|
registerBuildHook({
|
|
2515
2492
|
context,
|
|
@@ -2566,12 +2543,12 @@ var webpackProvider = async ({
|
|
|
2566
2543
|
setCssExtractPlugin(cssExtractPlugin);
|
|
2567
2544
|
const createCompiler2 = async () => {
|
|
2568
2545
|
const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2569
|
-
const
|
|
2546
|
+
const result = await createCompiler3({
|
|
2570
2547
|
context,
|
|
2571
2548
|
pluginManager,
|
|
2572
2549
|
rsbuildOptions
|
|
2573
2550
|
});
|
|
2574
|
-
return
|
|
2551
|
+
return result.compiler;
|
|
2575
2552
|
};
|
|
2576
2553
|
const { pluginAdaptor: pluginAdaptor2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
|
|
2577
2554
|
pluginManager.addPlugins([pluginAdaptor2()]);
|
|
@@ -2587,17 +2564,15 @@ var webpackProvider = async ({
|
|
|
2587
2564
|
return webpackConfigs;
|
|
2588
2565
|
},
|
|
2589
2566
|
async createDevServer(options) {
|
|
2590
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2591
2567
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
2592
2568
|
return createDevServer(
|
|
2593
2569
|
{ context, pluginManager, rsbuildOptions },
|
|
2594
|
-
|
|
2570
|
+
createCompiler2,
|
|
2595
2571
|
config,
|
|
2596
2572
|
options
|
|
2597
2573
|
);
|
|
2598
2574
|
},
|
|
2599
2575
|
async startDevServer(options) {
|
|
2600
|
-
const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
|
|
2601
2576
|
const config = await initRsbuildConfig({
|
|
2602
2577
|
context,
|
|
2603
2578
|
pluginManager
|
|
@@ -2608,7 +2583,7 @@ var webpackProvider = async ({
|
|
|
2608
2583
|
pluginManager,
|
|
2609
2584
|
rsbuildOptions
|
|
2610
2585
|
},
|
|
2611
|
-
|
|
2586
|
+
createCompiler2,
|
|
2612
2587
|
config,
|
|
2613
2588
|
options
|
|
2614
2589
|
);
|
package/dist-types/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuildOptions } from '@rsbuild/core';
|
|
2
|
-
import {
|
|
2
|
+
import type { InitConfigsOptions } from './initConfigs';
|
|
3
3
|
export declare const build: (initOptions: InitConfigsOptions, { watch, compiler: customCompiler }?: BuildOptions) => Promise<void | {
|
|
4
4
|
close: () => Promise<void>;
|
|
5
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;
|
|
@@ -23,6 +23,6 @@ declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildC
|
|
|
23
23
|
isWatch: boolean;
|
|
24
24
|
MultiStatsCtor: new (stats: import("@rspack/core").Stats[]) => import("@rspack/core").MultiStats;
|
|
25
25
|
}) => void, prettyTime: (seconds: number) => string;
|
|
26
|
-
export { getChainUtils, initRsbuildConfig, createDevServer, formatStats,
|
|
26
|
+
export { getChainUtils, initRsbuildConfig, createDevServer, formatStats, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, registerDevHook, registerBuildHook, prettyTime, getRsbuildInspectConfig, };
|
|
27
27
|
export type InternalContext = __internalHelper.InternalContext;
|
|
28
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-beta.
|
|
3
|
+
"version": "1.0.1-beta.16",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"reduce-configs": "^1.0.0",
|
|
31
31
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
32
32
|
"webpack": "^5.93.0",
|
|
33
|
-
"@rsbuild/core": "1.0.1-beta.
|
|
33
|
+
"@rsbuild/core": "1.0.1-beta.16"
|
|
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-beta.
|
|
41
|
+
"@scripts/test-helper": "1.0.1-beta.16"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|