@rsbuild/webpack 1.3.3 → 1.4.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/{997.cjs → 0.cjs} +1 -1
- package/dist/{997.js → 0.js} +2 -1
- package/dist/{818.cjs → 363.cjs} +44 -53
- package/dist/{812.js → 560.js} +45 -53
- package/dist/index.cjs +11 -14
- package/dist/index.js +12 -15
- package/package.json +9 -9
package/dist/{997.cjs → 0.cjs}
RENAMED
package/dist/{997.js → 0.js}
RENAMED
package/dist/{818.cjs → 363.cjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.ids = [
|
|
3
|
-
"
|
|
3
|
+
"363"
|
|
4
4
|
], exports.modules = {
|
|
5
5
|
"./src/progress/ProgressPlugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -27,14 +27,6 @@ exports.ids = [
|
|
|
27
27
|
hasErrors: !1
|
|
28
28
|
};
|
|
29
29
|
var external_node_console_ = __webpack_require__("node:console"), build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"), build_default = __webpack_require__.n(build), ansi_escapes = __webpack_require__("../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"), ansi_escapes_default = __webpack_require__.n(ansi_escapes);
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
32
|
-
value: value,
|
|
33
|
-
enumerable: !0,
|
|
34
|
-
configurable: !0,
|
|
35
|
-
writable: !0
|
|
36
|
-
}) : obj[key] = value, obj;
|
|
37
|
-
}
|
|
38
30
|
let colorList = [
|
|
39
31
|
'green',
|
|
40
32
|
'cyan',
|
|
@@ -42,6 +34,26 @@ exports.ids = [
|
|
|
42
34
|
'blue',
|
|
43
35
|
'magenta'
|
|
44
36
|
], bus = new class {
|
|
37
|
+
states = [];
|
|
38
|
+
log;
|
|
39
|
+
restore;
|
|
40
|
+
prevOutput;
|
|
41
|
+
destroyed = !1;
|
|
42
|
+
constructor(){
|
|
43
|
+
this.prevOutput = '', this.log = ((stream)=>{
|
|
44
|
+
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
45
|
+
let output = `${str}\n`;
|
|
46
|
+
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
47
|
+
};
|
|
48
|
+
return render.clear = ()=>{
|
|
49
|
+
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
50
|
+
}, render.done = ()=>{
|
|
51
|
+
previousOutput = '', previousLineCount = 0;
|
|
52
|
+
}, render;
|
|
53
|
+
})(process.stdout), console.Console = external_node_console_.Console, this.restore = build_default()((type, data)=>{
|
|
54
|
+
this.writeToStd(type, data);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
45
57
|
update(state) {
|
|
46
58
|
let index = this.states.findIndex((i)=>i.id === state.id);
|
|
47
59
|
if (-1 === index) return void this.states.push(state);
|
|
@@ -51,10 +63,7 @@ exports.ids = [
|
|
|
51
63
|
this.log.clear(), data && ('stdout' === type ? process.stdout.write(data) : 'stderr' === type && process.stderr.write(data)), this.log(this.prevOutput);
|
|
52
64
|
}
|
|
53
65
|
render() {
|
|
54
|
-
let maxIdLen = Math.max(...this.states.map((i)=>{
|
|
55
|
-
var _i_id;
|
|
56
|
-
return (null == (_i_id = i.id) ? void 0 : _i_id.length) ?? 0;
|
|
57
|
-
})) + 2, { columns = 70 } = process.stdout;
|
|
66
|
+
let maxIdLen = Math.max(...this.states.map((i)=>i.id?.length ?? 0)) + 2, { columns = 70 } = process.stdout;
|
|
58
67
|
this.prevOutput = this.states.map((i, k)=>{
|
|
59
68
|
let bar = ((option)=>{
|
|
60
69
|
let mergedOptions = {
|
|
@@ -119,47 +128,13 @@ exports.ids = [
|
|
|
119
128
|
clear() {
|
|
120
129
|
this.log.clear(), this.log.done();
|
|
121
130
|
}
|
|
122
|
-
constructor(){
|
|
123
|
-
_define_property(this, "states", []), _define_property(this, "log", void 0), _define_property(this, "restore", void 0), _define_property(this, "prevOutput", void 0), _define_property(this, "destroyed", !1), this.prevOutput = '', this.log = ((stream)=>{
|
|
124
|
-
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
125
|
-
let output = `${str}\n`;
|
|
126
|
-
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
127
|
-
};
|
|
128
|
-
return render.clear = ()=>{
|
|
129
|
-
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
130
|
-
}, render.done = ()=>{
|
|
131
|
-
previousOutput = '', previousLineCount = 0;
|
|
132
|
-
}, render;
|
|
133
|
-
})(process.stdout), console.Console = external_node_console_.Console, this.restore = build_default()((type, data)=>{
|
|
134
|
-
this.writeToStd(type, data);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
131
|
}();
|
|
138
|
-
function ProgressPlugin_define_property(obj, key, value) {
|
|
139
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
140
|
-
value: value,
|
|
141
|
-
enumerable: !0,
|
|
142
|
-
configurable: !0,
|
|
143
|
-
writable: !0
|
|
144
|
-
}) : obj[key] = value, obj;
|
|
145
|
-
}
|
|
146
132
|
class ProgressPlugin extends external_webpack_default().ProgressPlugin {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
153
|
-
if (startTime) {
|
|
154
|
-
this.hasCompileErrors = stat.hasErrors();
|
|
155
|
-
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
156
|
-
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
157
|
-
let suffix = this.id ? external_picocolors_default().gray(` (${this.id})`) : '';
|
|
158
|
-
core_.logger.ready(`built in ${this.compileTime} ${suffix}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
133
|
+
name = 'ProgressPlugin';
|
|
134
|
+
id;
|
|
135
|
+
hasCompileErrors = !1;
|
|
136
|
+
compileTime = null;
|
|
137
|
+
prettyTime;
|
|
163
138
|
constructor(options){
|
|
164
139
|
let { id = 'Rsbuild' } = options, nonTTYLogger = function() {
|
|
165
140
|
let prevPercentage = 0;
|
|
@@ -208,7 +183,23 @@ exports.ids = [
|
|
|
208
183
|
compileTime: this.compileTime
|
|
209
184
|
});
|
|
210
185
|
}
|
|
211
|
-
}),
|
|
186
|
+
}), this.id = id, this.prettyTime = options.prettyTime;
|
|
187
|
+
}
|
|
188
|
+
apply(compiler) {
|
|
189
|
+
super.apply(compiler);
|
|
190
|
+
let startTime = null;
|
|
191
|
+
compiler.hooks.compile.tap(this.name, ()=>{
|
|
192
|
+
this.compileTime = null, startTime = process.hrtime();
|
|
193
|
+
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
194
|
+
if (startTime) {
|
|
195
|
+
this.hasCompileErrors = stat.hasErrors();
|
|
196
|
+
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
197
|
+
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
198
|
+
let suffix = this.id ? external_picocolors_default().gray(` (${this.id})`) : '';
|
|
199
|
+
core_.logger.ready(`built in ${this.compileTime} ${suffix}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
212
203
|
}
|
|
213
204
|
}
|
|
214
205
|
}
|
package/dist/{812.js → 560.js}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export const __webpack_id__ = "560";
|
|
1
2
|
export const __webpack_ids__ = [
|
|
2
|
-
"
|
|
3
|
+
"560"
|
|
3
4
|
];
|
|
4
5
|
export const __webpack_modules__ = {
|
|
5
6
|
"./src/progress/ProgressPlugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -27,14 +28,6 @@ export const __webpack_modules__ = {
|
|
|
27
28
|
hasErrors: !1
|
|
28
29
|
};
|
|
29
30
|
var external_node_console_ = __webpack_require__("node:console"), build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"), build_default = __webpack_require__.n(build), ansi_escapes = __webpack_require__("../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"), ansi_escapes_default = __webpack_require__.n(ansi_escapes);
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
32
|
-
value: value,
|
|
33
|
-
enumerable: !0,
|
|
34
|
-
configurable: !0,
|
|
35
|
-
writable: !0
|
|
36
|
-
}) : obj[key] = value, obj;
|
|
37
|
-
}
|
|
38
31
|
let colorList = [
|
|
39
32
|
'green',
|
|
40
33
|
'cyan',
|
|
@@ -42,6 +35,26 @@ export const __webpack_modules__ = {
|
|
|
42
35
|
'blue',
|
|
43
36
|
'magenta'
|
|
44
37
|
], bus = new class {
|
|
38
|
+
states = [];
|
|
39
|
+
log;
|
|
40
|
+
restore;
|
|
41
|
+
prevOutput;
|
|
42
|
+
destroyed = !1;
|
|
43
|
+
constructor(){
|
|
44
|
+
this.prevOutput = '', this.log = ((stream)=>{
|
|
45
|
+
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
46
|
+
let output = `${str}\n`;
|
|
47
|
+
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
48
|
+
};
|
|
49
|
+
return render.clear = ()=>{
|
|
50
|
+
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
51
|
+
}, render.done = ()=>{
|
|
52
|
+
previousOutput = '', previousLineCount = 0;
|
|
53
|
+
}, render;
|
|
54
|
+
})(process.stdout), console.Console = external_node_console_.Console, this.restore = build_default()((type, data)=>{
|
|
55
|
+
this.writeToStd(type, data);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
45
58
|
update(state) {
|
|
46
59
|
let index = this.states.findIndex((i)=>i.id === state.id);
|
|
47
60
|
if (-1 === index) return void this.states.push(state);
|
|
@@ -51,10 +64,7 @@ export const __webpack_modules__ = {
|
|
|
51
64
|
this.log.clear(), data && ('stdout' === type ? process.stdout.write(data) : 'stderr' === type && process.stderr.write(data)), this.log(this.prevOutput);
|
|
52
65
|
}
|
|
53
66
|
render() {
|
|
54
|
-
let maxIdLen = Math.max(...this.states.map((i)=>{
|
|
55
|
-
var _i_id;
|
|
56
|
-
return (null == (_i_id = i.id) ? void 0 : _i_id.length) ?? 0;
|
|
57
|
-
})) + 2, { columns = 70 } = process.stdout;
|
|
67
|
+
let maxIdLen = Math.max(...this.states.map((i)=>i.id?.length ?? 0)) + 2, { columns = 70 } = process.stdout;
|
|
58
68
|
this.prevOutput = this.states.map((i, k)=>{
|
|
59
69
|
let bar = ((option)=>{
|
|
60
70
|
let mergedOptions = {
|
|
@@ -119,47 +129,13 @@ export const __webpack_modules__ = {
|
|
|
119
129
|
clear() {
|
|
120
130
|
this.log.clear(), this.log.done();
|
|
121
131
|
}
|
|
122
|
-
constructor(){
|
|
123
|
-
_define_property(this, "states", []), _define_property(this, "log", void 0), _define_property(this, "restore", void 0), _define_property(this, "prevOutput", void 0), _define_property(this, "destroyed", !1), this.prevOutput = '', this.log = ((stream)=>{
|
|
124
|
-
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
125
|
-
let output = `${str}\n`;
|
|
126
|
-
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
127
|
-
};
|
|
128
|
-
return render.clear = ()=>{
|
|
129
|
-
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
130
|
-
}, render.done = ()=>{
|
|
131
|
-
previousOutput = '', previousLineCount = 0;
|
|
132
|
-
}, render;
|
|
133
|
-
})(process.stdout), console.Console = external_node_console_.Console, this.restore = build_default()((type, data)=>{
|
|
134
|
-
this.writeToStd(type, data);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
132
|
}();
|
|
138
|
-
function ProgressPlugin_define_property(obj, key, value) {
|
|
139
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
140
|
-
value: value,
|
|
141
|
-
enumerable: !0,
|
|
142
|
-
configurable: !0,
|
|
143
|
-
writable: !0
|
|
144
|
-
}) : obj[key] = value, obj;
|
|
145
|
-
}
|
|
146
133
|
class ProgressPlugin extends external_webpack_.default.ProgressPlugin {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
153
|
-
if (startTime) {
|
|
154
|
-
this.hasCompileErrors = stat.hasErrors();
|
|
155
|
-
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
156
|
-
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
157
|
-
let suffix = this.id ? external_picocolors_.default.gray(` (${this.id})`) : '';
|
|
158
|
-
core_.logger.ready(`built in ${this.compileTime} ${suffix}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
134
|
+
name = 'ProgressPlugin';
|
|
135
|
+
id;
|
|
136
|
+
hasCompileErrors = !1;
|
|
137
|
+
compileTime = null;
|
|
138
|
+
prettyTime;
|
|
163
139
|
constructor(options){
|
|
164
140
|
let prevPercentage, prevPercentage1, { id = 'Rsbuild' } = options, nonTTYLogger = (prevPercentage = 0, {
|
|
165
141
|
log: ({ id, done, current, hasErrors, compileTime })=>{
|
|
@@ -202,7 +178,23 @@ export const __webpack_modules__ = {
|
|
|
202
178
|
compileTime: this.compileTime
|
|
203
179
|
});
|
|
204
180
|
}
|
|
205
|
-
}),
|
|
181
|
+
}), this.id = id, this.prettyTime = options.prettyTime;
|
|
182
|
+
}
|
|
183
|
+
apply(compiler) {
|
|
184
|
+
super.apply(compiler);
|
|
185
|
+
let startTime = null;
|
|
186
|
+
compiler.hooks.compile.tap(this.name, ()=>{
|
|
187
|
+
this.compileTime = null, startTime = process.hrtime();
|
|
188
|
+
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
189
|
+
if (startTime) {
|
|
190
|
+
this.hasCompileErrors = stat.hasErrors();
|
|
191
|
+
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
192
|
+
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
193
|
+
let suffix = this.id ? external_picocolors_.default.gray(` (${this.id})`) : '';
|
|
194
|
+
core_.logger.ready(`built in ${this.compileTime} ${suffix}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
206
198
|
}
|
|
207
199
|
}
|
|
208
200
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
70
70
|
});
|
|
71
71
|
}, __webpack_require__.nmd = (module)=>(module.paths = [], module.children || (module.children = []), module), (()=>{
|
|
72
72
|
var installedChunks = {
|
|
73
|
-
|
|
73
|
+
410: 1
|
|
74
74
|
};
|
|
75
75
|
__webpack_require__.f.require = (chunkId, promises)=>{
|
|
76
76
|
installedChunks[chunkId] || ((chunk)=>{
|
|
@@ -93,7 +93,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
93
93
|
arr
|
|
94
94
|
];
|
|
95
95
|
async function modifyWebpackChain(context, utils, chain) {
|
|
96
|
-
var _utils_environment_config_tools;
|
|
97
96
|
core_.logger.debug('modify webpack chain');
|
|
98
97
|
let [modifiedChain] = await context.hooks.modifyWebpackChain.callChain({
|
|
99
98
|
environment: utils.environment.name,
|
|
@@ -102,11 +101,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
102
101
|
utils
|
|
103
102
|
]
|
|
104
103
|
});
|
|
105
|
-
if (
|
|
104
|
+
if (utils.environment.config.tools?.webpackChain) for (let item of castArray(utils.environment.config.tools.webpackChain))item(modifiedChain, utils);
|
|
106
105
|
return core_.logger.debug('modify webpack chain done'), modifiedChain;
|
|
107
106
|
}
|
|
108
107
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
109
|
-
var _utils_environment_config_tools;
|
|
110
108
|
core_.logger.debug('modify webpack config');
|
|
111
109
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.callChain({
|
|
112
110
|
environment: utils.environment.name,
|
|
@@ -115,7 +113,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
115
113
|
utils
|
|
116
114
|
]
|
|
117
115
|
});
|
|
118
|
-
return
|
|
116
|
+
return utils.environment.config.tools?.webpack && (modifiedConfig = (0, external_reduce_configs_namespaceObject.reduceConfigsWithContext)({
|
|
119
117
|
initial: modifiedConfig,
|
|
120
118
|
config: utils.environment.config.tools.webpack,
|
|
121
119
|
ctx: utils,
|
|
@@ -146,7 +144,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
146
144
|
SourceMapDevToolPlugin,
|
|
147
145
|
HotModuleReplacementPlugin
|
|
148
146
|
}
|
|
149
|
-
}), webpackConfig = (await modifyWebpackChain(context, chainUtils, bundlerChain)).toConfig(), configUtils =
|
|
147
|
+
}), webpackConfig = (await modifyWebpackChain(context, chainUtils, bundlerChain)).toConfig(), configUtils = helpers.getConfigUtils(()=>webpackConfig, chainUtils);
|
|
150
148
|
return webpackConfig = await modifyWebpackConfig(context, webpackConfig, configUtils);
|
|
151
149
|
}
|
|
152
150
|
async function initConfigs({ context, pluginManager, rsbuildOptions, helpers }) {
|
|
@@ -182,7 +180,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
182
180
|
};
|
|
183
181
|
}
|
|
184
182
|
async function createCompiler_createCompiler(options) {
|
|
185
|
-
core_.logger.debug('
|
|
183
|
+
core_.logger.debug('creating compiler');
|
|
186
184
|
let { helpers, context } = options, { webpackConfigs } = await initConfigs(options);
|
|
187
185
|
await context.hooks.onBeforeCreateCompiler.callBatch({
|
|
188
186
|
bundlerConfigs: webpackConfigs,
|
|
@@ -206,7 +204,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
206
204
|
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
207
205
|
compiler,
|
|
208
206
|
environments: context.environments
|
|
209
|
-
}), core_.logger.debug('
|
|
207
|
+
}), core_.logger.debug('compiler created'), {
|
|
210
208
|
compiler,
|
|
211
209
|
webpackConfigs
|
|
212
210
|
};
|
|
@@ -235,7 +233,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
235
233
|
};
|
|
236
234
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
237
235
|
compiler.run((err, stats)=>{
|
|
238
|
-
err ? reject(err) :
|
|
236
|
+
err ? reject(err) : stats?.hasErrors() ? reject(Error('webpack build failed.')) : compiler.close((closeErr)=>{
|
|
239
237
|
closeErr && core_.logger.error(closeErr), resolve({
|
|
240
238
|
stats
|
|
241
239
|
});
|
|
@@ -297,8 +295,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
297
295
|
let progress = config.dev.progressBar ?? !0;
|
|
298
296
|
if (progress) {
|
|
299
297
|
let { ProgressPlugin } = await Promise.all([
|
|
300
|
-
__webpack_require__.e("
|
|
301
|
-
__webpack_require__.e("
|
|
298
|
+
__webpack_require__.e("0"),
|
|
299
|
+
__webpack_require__.e("363")
|
|
302
300
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
303
301
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
304
302
|
{
|
|
@@ -318,9 +316,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
318
316
|
]);
|
|
319
317
|
}
|
|
320
318
|
}), api.modifyWebpackConfig(async (config)=>{
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
copyPlugin && copyPlugin.patterns.every((pattern)=>'string' != typeof pattern && pattern.context && !external_node_fs_default().existsSync(pattern.context)) && (config.plugins = null == (_config_plugins1 = config.plugins) ? void 0 : _config_plugins1.filter((item)=>(null == item ? void 0 : item.constructor.name) !== 'CopyPlugin'));
|
|
319
|
+
let copyPlugin = config.plugins?.find((item)=>item?.constructor.name === 'CopyPlugin');
|
|
320
|
+
copyPlugin && copyPlugin.patterns.every((pattern)=>'string' != typeof pattern && pattern.context && !external_node_fs_default().existsSync(pattern.context)) && (config.plugins = config.plugins?.filter((item)=>item?.constructor.name !== 'CopyPlugin'));
|
|
324
321
|
});
|
|
325
322
|
}
|
|
326
323
|
})
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
44
44
|
get: definition[key]
|
|
45
45
|
});
|
|
46
46
|
}, __webpack_require__.f = {}, __webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>(__webpack_require__.f[key](chunkId, promises), promises), [])), __webpack_require__.u = (chunkId)=>"" + chunkId + ".js", __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.nmd = (module)=>(module.paths = [], module.children || (module.children = []), module), installedChunks = {
|
|
47
|
-
|
|
47
|
+
410: 0
|
|
48
48
|
}, installChunk = (data)=>{
|
|
49
49
|
var moduleId, chunkId, __webpack_ids__ = data.__webpack_ids__, __webpack_modules__ = data.__webpack_modules__, __webpack_runtime__ = data.__webpack_runtime__, i = 0;
|
|
50
50
|
for(moduleId in __webpack_modules__)__webpack_require__.o(__webpack_modules__, moduleId) && (__webpack_require__.m[moduleId] = __webpack_modules__[moduleId]);
|
|
@@ -71,7 +71,6 @@ let castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
|
71
71
|
arr
|
|
72
72
|
];
|
|
73
73
|
async function modifyWebpackChain(context, utils, chain) {
|
|
74
|
-
var _utils_environment_config_tools;
|
|
75
74
|
core_.logger.debug('modify webpack chain');
|
|
76
75
|
let [modifiedChain] = await context.hooks.modifyWebpackChain.callChain({
|
|
77
76
|
environment: utils.environment.name,
|
|
@@ -80,11 +79,10 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
80
79
|
utils
|
|
81
80
|
]
|
|
82
81
|
});
|
|
83
|
-
if (
|
|
82
|
+
if (utils.environment.config.tools?.webpackChain) for (let item of castArray(utils.environment.config.tools.webpackChain))item(modifiedChain, utils);
|
|
84
83
|
return core_.logger.debug('modify webpack chain done'), modifiedChain;
|
|
85
84
|
}
|
|
86
85
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
87
|
-
var _utils_environment_config_tools;
|
|
88
86
|
core_.logger.debug('modify webpack config');
|
|
89
87
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.callChain({
|
|
90
88
|
environment: utils.environment.name,
|
|
@@ -93,7 +91,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
93
91
|
utils
|
|
94
92
|
]
|
|
95
93
|
});
|
|
96
|
-
return
|
|
94
|
+
return utils.environment.config.tools?.webpack && (modifiedConfig = reduceConfigsWithContext({
|
|
97
95
|
initial: modifiedConfig,
|
|
98
96
|
config: utils.environment.config.tools.webpack,
|
|
99
97
|
ctx: utils,
|
|
@@ -124,8 +122,8 @@ async function generateWebpackConfig({ target, context, environment, helpers })
|
|
|
124
122
|
SourceMapDevToolPlugin,
|
|
125
123
|
HotModuleReplacementPlugin
|
|
126
124
|
}
|
|
127
|
-
}), webpackConfig = (await modifyWebpackChain(context, chainUtils, bundlerChain)).toConfig(), configUtils =
|
|
128
|
-
return await modifyWebpackConfig(context, webpackConfig, configUtils);
|
|
125
|
+
}), webpackConfig = (await modifyWebpackChain(context, chainUtils, bundlerChain)).toConfig(), configUtils = helpers.getConfigUtils(()=>webpackConfig, chainUtils);
|
|
126
|
+
return webpackConfig = await modifyWebpackConfig(context, webpackConfig, configUtils);
|
|
129
127
|
}
|
|
130
128
|
async function initConfigs({ context, pluginManager, rsbuildOptions, helpers }) {
|
|
131
129
|
let normalizedConfig = await helpers.initRsbuildConfig({
|
|
@@ -160,7 +158,7 @@ async function initConfigs({ context, pluginManager, rsbuildOptions, helpers })
|
|
|
160
158
|
};
|
|
161
159
|
}
|
|
162
160
|
async function createCompiler_createCompiler(options) {
|
|
163
|
-
core_.logger.debug('
|
|
161
|
+
core_.logger.debug('creating compiler');
|
|
164
162
|
let { helpers, context } = options, { webpackConfigs } = await initConfigs(options);
|
|
165
163
|
await context.hooks.onBeforeCreateCompiler.callBatch({
|
|
166
164
|
bundlerConfigs: webpackConfigs,
|
|
@@ -183,7 +181,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
183
181
|
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
184
182
|
compiler,
|
|
185
183
|
environments: context.environments
|
|
186
|
-
}), core_.logger.debug('
|
|
184
|
+
}), core_.logger.debug('compiler created'), {
|
|
187
185
|
compiler,
|
|
188
186
|
webpackConfigs
|
|
189
187
|
};
|
|
@@ -212,7 +210,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
212
210
|
};
|
|
213
211
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
214
212
|
compiler.run((err, stats)=>{
|
|
215
|
-
err ? reject(err) :
|
|
213
|
+
err ? reject(err) : stats?.hasErrors() ? reject(Error('webpack build failed.')) : compiler.close((closeErr)=>{
|
|
216
214
|
closeErr && core_.logger.error(closeErr), resolve({
|
|
217
215
|
stats
|
|
218
216
|
});
|
|
@@ -272,8 +270,8 @@ let webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers }
|
|
|
272
270
|
let progress = config.dev.progressBar ?? !0;
|
|
273
271
|
if (progress) {
|
|
274
272
|
let { ProgressPlugin } = await Promise.all([
|
|
275
|
-
__webpack_require__.e("
|
|
276
|
-
__webpack_require__.e("
|
|
273
|
+
__webpack_require__.e("0"),
|
|
274
|
+
__webpack_require__.e("560")
|
|
277
275
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
278
276
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
279
277
|
{
|
|
@@ -293,9 +291,8 @@ let webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers }
|
|
|
293
291
|
]);
|
|
294
292
|
}
|
|
295
293
|
}), api.modifyWebpackConfig(async (config)=>{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
copyPlugin && copyPlugin.patterns.every((pattern)=>'string' != typeof pattern && pattern.context && !node_fs.existsSync(pattern.context)) && (config.plugins = null == (_config_plugins1 = config.plugins) ? void 0 : _config_plugins1.filter((item)=>(null == item ? void 0 : item.constructor.name) !== 'CopyPlugin'));
|
|
294
|
+
let copyPlugin = config.plugins?.find((item)=>item?.constructor.name === 'CopyPlugin');
|
|
295
|
+
copyPlugin && copyPlugin.patterns.every((pattern)=>'string' != typeof pattern && pattern.context && !node_fs.existsSync(pattern.context)) && (config.plugins = config.plugins?.filter((item)=>item?.constructor.name !== 'CopyPlugin'));
|
|
299
296
|
});
|
|
300
297
|
}
|
|
301
298
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"homepage": "https://rsbuild.rs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"copy-webpack-plugin": "11.0.0",
|
|
27
|
-
"html-webpack-plugin": "^5.6.
|
|
28
|
-
"mini-css-extract-plugin": "2.9.
|
|
27
|
+
"html-webpack-plugin": "^5.6.4",
|
|
28
|
+
"mini-css-extract-plugin": "2.9.4",
|
|
29
29
|
"picocolors": "^1.1.1",
|
|
30
|
-
"reduce-configs": "^1.1.
|
|
30
|
+
"reduce-configs": "^1.1.1",
|
|
31
31
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
32
|
-
"webpack": "^5.101.
|
|
32
|
+
"webpack": "^5.101.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@rslib/core": "0.
|
|
36
|
-
"@types/node": "^22.17.
|
|
35
|
+
"@rslib/core": "0.12.2",
|
|
36
|
+
"@types/node": "^22.17.2",
|
|
37
37
|
"ansi-escapes": "4.3.2",
|
|
38
38
|
"cli-truncate": "2.1.0",
|
|
39
39
|
"patch-console": "1.0.0",
|
|
40
40
|
"typescript": "^5.9.2",
|
|
41
|
-
"@rsbuild/core": "1.
|
|
41
|
+
"@rsbuild/core": "1.5.0",
|
|
42
42
|
"@scripts/test-helper": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "rslib build",
|
|
53
53
|
"dev": "rslib build --watch",
|
|
54
|
-
"bump": "
|
|
54
|
+
"bump": "pnpx bumpp --no-tag"
|
|
55
55
|
}
|
|
56
56
|
}
|