@rsbuild/webpack 1.3.1 → 1.3.3
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/README.md +1 -1
- package/dist/812.js +73 -77
- package/dist/818.cjs +86 -84
- package/dist/997.cjs +2 -15
- package/dist/997.js +2 -15
- package/dist/index.cjs +85 -113
- package/dist/index.d.ts +1 -1
- package/dist/index.js +76 -105
- package/dist/progress/helpers/index.d.ts +2 -2
- package/package.json +10 -10
- package/dist/inspectConfig.d.ts +0 -7
package/README.md
CHANGED
package/dist/812.js
CHANGED
|
@@ -6,7 +6,7 @@ export const __webpack_modules__ = {
|
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
ProgressPlugin: ()=>ProgressPlugin
|
|
8
8
|
});
|
|
9
|
-
var core_ = __webpack_require__("@rsbuild/core"), external_picocolors_ = __webpack_require__("picocolors"), external_webpack_ = __webpack_require__("webpack"),
|
|
9
|
+
var core_ = __webpack_require__("@rsbuild/core"), external_picocolors_ = __webpack_require__("picocolors"), external_webpack_ = __webpack_require__("webpack"), cli_truncate = __webpack_require__("../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"), cli_truncate_default = __webpack_require__.n(cli_truncate);
|
|
10
10
|
let clamp = (x, min, max)=>Math.min(max, Math.max(min, x)), defaultOption = {
|
|
11
11
|
total: 100,
|
|
12
12
|
current: 0,
|
|
@@ -25,66 +25,8 @@ export const __webpack_modules__ = {
|
|
|
25
25
|
id: '',
|
|
26
26
|
maxIdLen: 16,
|
|
27
27
|
hasErrors: !1
|
|
28
|
-
}, padding = (id, maxLen)=>{
|
|
29
|
-
let left = Math.floor((maxLen - id.length) / 2), right = maxLen - left - id.length;
|
|
30
|
-
return ' '.repeat(left) + id + ' '.repeat(right);
|
|
31
|
-
}, renderBar = (option)=>{
|
|
32
|
-
let mergedOptions = {
|
|
33
|
-
...defaultOption,
|
|
34
|
-
...option
|
|
35
|
-
}, { total, done, buildIcon, errorIcon, errorInfo, width, current, color, bgColor, char, message, messageWidth, spaceWidth, messageColor, maxIdLen, hasErrors } = mergedOptions, space = ' '.repeat(spaceWidth), percent = clamp(Math.floor(current / total * 100), 0, 100), barColor = external_picocolors_.default[color], backgroundColor = external_picocolors_.default[bgColor], doneColor = hasErrors ? external_picocolors_.default.red : barColor, idColor = done ? doneColor : barColor, id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : '', { columns: terminalWidth = 70 } = process.stdout;
|
|
36
|
-
if (done) {
|
|
37
|
-
if (hasErrors) {
|
|
38
|
-
let message = external_picocolors_.default.bold(doneColor(errorInfo));
|
|
39
|
-
return terminalWidth >= 40 ? [
|
|
40
|
-
idColor(errorIcon),
|
|
41
|
-
id,
|
|
42
|
-
doneColor(`${space}${message}`)
|
|
43
|
-
].join('') : [
|
|
44
|
-
id,
|
|
45
|
-
doneColor(`${message}`)
|
|
46
|
-
].join('');
|
|
47
|
-
}
|
|
48
|
-
return '';
|
|
49
|
-
}
|
|
50
|
-
let msgStr = external_picocolors_.default[messageColor](cli_truncate_default()(message, messageWidth, {
|
|
51
|
-
position: 'start'
|
|
52
|
-
})), left = clamp(Math.floor(percent * width / 100), 0, width), right = clamp(width - left, 0, width), barStr = `${barColor(char.repeat(left))}${backgroundColor(char.repeat(right))}`, percentStr = `${percent.toString().padStart(3)}%`;
|
|
53
|
-
return terminalWidth >= 70 ? [
|
|
54
|
-
idColor(buildIcon),
|
|
55
|
-
id,
|
|
56
|
-
space,
|
|
57
|
-
barStr,
|
|
58
|
-
space,
|
|
59
|
-
percentStr,
|
|
60
|
-
space,
|
|
61
|
-
msgStr
|
|
62
|
-
].join('') : terminalWidth >= 40 ? [
|
|
63
|
-
idColor(buildIcon),
|
|
64
|
-
id,
|
|
65
|
-
space,
|
|
66
|
-
barStr,
|
|
67
|
-
space,
|
|
68
|
-
percentStr
|
|
69
|
-
].join('') : [
|
|
70
|
-
idColor(buildIcon),
|
|
71
|
-
id,
|
|
72
|
-
space,
|
|
73
|
-
percentStr
|
|
74
|
-
].join('');
|
|
75
|
-
};
|
|
76
|
-
var 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);
|
|
77
|
-
let create = (stream)=>{
|
|
78
|
-
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
79
|
-
let output = `${str}\n`;
|
|
80
|
-
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
81
|
-
};
|
|
82
|
-
return render.clear = ()=>{
|
|
83
|
-
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
84
|
-
}, render.done = ()=>{
|
|
85
|
-
previousOutput = '', previousLineCount = 0;
|
|
86
|
-
}, render;
|
|
87
28
|
};
|
|
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);
|
|
88
30
|
function _define_property(obj, key, value) {
|
|
89
31
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
90
32
|
value: value,
|
|
@@ -99,7 +41,7 @@ export const __webpack_modules__ = {
|
|
|
99
41
|
'yellow',
|
|
100
42
|
'blue',
|
|
101
43
|
'magenta'
|
|
102
|
-
],
|
|
44
|
+
], bus = new class {
|
|
103
45
|
update(state) {
|
|
104
46
|
let index = this.states.findIndex((i)=>i.id === state.id);
|
|
105
47
|
if (-1 === index) return void this.states.push(state);
|
|
@@ -114,9 +56,56 @@ export const __webpack_modules__ = {
|
|
|
114
56
|
return (null == (_i_id = i.id) ? void 0 : _i_id.length) ?? 0;
|
|
115
57
|
})) + 2, { columns = 70 } = process.stdout;
|
|
116
58
|
this.prevOutput = this.states.map((i, k)=>{
|
|
117
|
-
let bar =
|
|
59
|
+
let bar = ((option)=>{
|
|
60
|
+
let mergedOptions = {
|
|
61
|
+
...defaultOption,
|
|
62
|
+
...option
|
|
63
|
+
}, { total, done, buildIcon, errorIcon, errorInfo, width, current, color, bgColor, char, message, messageWidth, spaceWidth, messageColor, maxIdLen, hasErrors } = mergedOptions, space = ' '.repeat(spaceWidth), percent = clamp(Math.floor(current / total * 100), 0, 100), barColor = external_picocolors_.default[color], backgroundColor = external_picocolors_.default[bgColor], doneColor = hasErrors ? external_picocolors_.default.red : barColor, idColor = done ? doneColor : barColor, id = mergedOptions.id ? idColor(((id, maxLen)=>{
|
|
64
|
+
let left = Math.floor((maxLen - id.length) / 2), right = maxLen - left - id.length;
|
|
65
|
+
return ' '.repeat(left) + id + ' '.repeat(right);
|
|
66
|
+
})(mergedOptions.id, maxIdLen)) : '', { columns: terminalWidth = 70 } = process.stdout;
|
|
67
|
+
if (done) {
|
|
68
|
+
if (hasErrors) {
|
|
69
|
+
let message = external_picocolors_.default.bold(doneColor(errorInfo));
|
|
70
|
+
return terminalWidth >= 40 ? [
|
|
71
|
+
idColor(errorIcon),
|
|
72
|
+
id,
|
|
73
|
+
doneColor(`${space}${message}`)
|
|
74
|
+
].join('') : [
|
|
75
|
+
id,
|
|
76
|
+
doneColor(`${message}`)
|
|
77
|
+
].join('');
|
|
78
|
+
}
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
let msgStr = external_picocolors_.default[messageColor](cli_truncate_default()(message, messageWidth, {
|
|
82
|
+
position: 'start'
|
|
83
|
+
})), left = clamp(Math.floor(percent * width / 100), 0, width), right = clamp(width - left, 0, width), barStr = `${barColor(char.repeat(left))}${backgroundColor(char.repeat(right))}`, percentStr = `${percent.toString().padStart(3)}%`;
|
|
84
|
+
return terminalWidth >= 70 ? [
|
|
85
|
+
idColor(buildIcon),
|
|
86
|
+
id,
|
|
87
|
+
space,
|
|
88
|
+
barStr,
|
|
89
|
+
space,
|
|
90
|
+
percentStr,
|
|
91
|
+
space,
|
|
92
|
+
msgStr
|
|
93
|
+
].join('') : terminalWidth >= 40 ? [
|
|
94
|
+
idColor(buildIcon),
|
|
95
|
+
id,
|
|
96
|
+
space,
|
|
97
|
+
barStr,
|
|
98
|
+
space,
|
|
99
|
+
percentStr
|
|
100
|
+
].join('') : [
|
|
101
|
+
idColor(buildIcon),
|
|
102
|
+
id,
|
|
103
|
+
space,
|
|
104
|
+
percentStr
|
|
105
|
+
].join('');
|
|
106
|
+
})({
|
|
118
107
|
maxIdLen,
|
|
119
|
-
color: i.color ??
|
|
108
|
+
color: i.color ?? colorList[k % colorList.length],
|
|
120
109
|
...i
|
|
121
110
|
});
|
|
122
111
|
return bar ? cli_truncate_default()(bar, columns, {
|
|
@@ -131,21 +120,21 @@ export const __webpack_modules__ = {
|
|
|
131
120
|
this.log.clear(), this.log.done();
|
|
132
121
|
}
|
|
133
122
|
constructor(){
|
|
134
|
-
_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 =
|
|
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)=>{
|
|
135
134
|
this.writeToStd(type, data);
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
|
-
}()
|
|
139
|
-
let prevPercentage = 0;
|
|
140
|
-
return (percentage)=>{
|
|
141
|
-
if (0 === percentage || 1 === percentage) return prevPercentage = 0, percentage;
|
|
142
|
-
if (percentage <= prevPercentage) {
|
|
143
|
-
let step = 0;
|
|
144
|
-
return prevPercentage < 0.3 ? step = 0.001 : prevPercentage < 0.6 ? step = 0.002 : prevPercentage < 0.8 ? step = 0.004 : prevPercentage < 0.99 && (step = 0.002), prevPercentage += step;
|
|
145
|
-
}
|
|
146
|
-
return prevPercentage = percentage, percentage;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
137
|
+
}();
|
|
149
138
|
function ProgressPlugin_define_property(obj, key, value) {
|
|
150
139
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
151
140
|
value: value,
|
|
@@ -172,7 +161,7 @@ export const __webpack_modules__ = {
|
|
|
172
161
|
});
|
|
173
162
|
}
|
|
174
163
|
constructor(options){
|
|
175
|
-
let prevPercentage, { id = 'Rsbuild' } = options, nonTTYLogger = (prevPercentage = 0, {
|
|
164
|
+
let prevPercentage, prevPercentage1, { id = 'Rsbuild' } = options, nonTTYLogger = (prevPercentage = 0, {
|
|
176
165
|
log: ({ id, done, current, hasErrors, compileTime })=>{
|
|
177
166
|
let suffix = external_picocolors_.default.gray(`(${id})`);
|
|
178
167
|
if (done) {
|
|
@@ -180,7 +169,14 @@ export const __webpack_modules__ = {
|
|
|
180
169
|
prevPercentage = 100, hasErrors ? core_.logger.error(`built failed in ${compileTime} ${suffix}`) : core_.logger.ready(`built in ${compileTime} ${suffix}`);
|
|
181
170
|
} else current - prevPercentage > 10 && (prevPercentage = current, core_.logger.info(`build progress: ${current.toFixed(0)}% ${suffix}`));
|
|
182
171
|
}
|
|
183
|
-
}), friendlyPercentage =
|
|
172
|
+
}), friendlyPercentage = (prevPercentage1 = 0, (percentage)=>{
|
|
173
|
+
if (0 === percentage || 1 === percentage) return prevPercentage1 = 0, percentage;
|
|
174
|
+
if (percentage <= prevPercentage1) {
|
|
175
|
+
let step = 0;
|
|
176
|
+
return prevPercentage1 < 0.3 ? step = 0.001 : prevPercentage1 < 0.6 ? step = 0.002 : prevPercentage1 < 0.8 ? step = 0.004 : prevPercentage1 < 0.99 && (step = 0.002), prevPercentage1 += step;
|
|
177
|
+
}
|
|
178
|
+
return prevPercentage1 = percentage, percentage;
|
|
179
|
+
});
|
|
184
180
|
super({
|
|
185
181
|
activeModules: !1,
|
|
186
182
|
entries: !0,
|
package/dist/818.cjs
CHANGED
|
@@ -6,7 +6,7 @@ exports.ids = [
|
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
ProgressPlugin: ()=>ProgressPlugin
|
|
8
8
|
});
|
|
9
|
-
var core_ = __webpack_require__("@rsbuild/core"), external_picocolors_ = __webpack_require__("picocolors"), external_picocolors_default = __webpack_require__.n(external_picocolors_), external_webpack_ = __webpack_require__("webpack?
|
|
9
|
+
var core_ = __webpack_require__("@rsbuild/core"), external_picocolors_ = __webpack_require__("picocolors"), external_picocolors_default = __webpack_require__.n(external_picocolors_), external_webpack_ = __webpack_require__("webpack?2a1e"), external_webpack_default = __webpack_require__.n(external_webpack_), cli_truncate = __webpack_require__("../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"), cli_truncate_default = __webpack_require__.n(cli_truncate);
|
|
10
10
|
let clamp = (x, min, max)=>Math.min(max, Math.max(min, x)), defaultOption = {
|
|
11
11
|
total: 100,
|
|
12
12
|
current: 0,
|
|
@@ -25,66 +25,8 @@ exports.ids = [
|
|
|
25
25
|
id: '',
|
|
26
26
|
maxIdLen: 16,
|
|
27
27
|
hasErrors: !1
|
|
28
|
-
}, padding = (id, maxLen)=>{
|
|
29
|
-
let left = Math.floor((maxLen - id.length) / 2), right = maxLen - left - id.length;
|
|
30
|
-
return ' '.repeat(left) + id + ' '.repeat(right);
|
|
31
|
-
}, renderBar = (option)=>{
|
|
32
|
-
let mergedOptions = {
|
|
33
|
-
...defaultOption,
|
|
34
|
-
...option
|
|
35
|
-
}, { total, done, buildIcon, errorIcon, errorInfo, width, current, color, bgColor, char, message, messageWidth, spaceWidth, messageColor, maxIdLen, hasErrors } = mergedOptions, space = ' '.repeat(spaceWidth), percent = clamp(Math.floor(current / total * 100), 0, 100), barColor = external_picocolors_default()[color], backgroundColor = external_picocolors_default()[bgColor], doneColor = hasErrors ? external_picocolors_default().red : barColor, idColor = done ? doneColor : barColor, id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : '', { columns: terminalWidth = 70 } = process.stdout;
|
|
36
|
-
if (done) {
|
|
37
|
-
if (hasErrors) {
|
|
38
|
-
let message = external_picocolors_default().bold(doneColor(errorInfo));
|
|
39
|
-
return terminalWidth >= 40 ? [
|
|
40
|
-
idColor(errorIcon),
|
|
41
|
-
id,
|
|
42
|
-
doneColor(`${space}${message}`)
|
|
43
|
-
].join('') : [
|
|
44
|
-
id,
|
|
45
|
-
doneColor(`${message}`)
|
|
46
|
-
].join('');
|
|
47
|
-
}
|
|
48
|
-
return '';
|
|
49
|
-
}
|
|
50
|
-
let msgStr = external_picocolors_default()[messageColor](cli_truncate_default()(message, messageWidth, {
|
|
51
|
-
position: 'start'
|
|
52
|
-
})), left = clamp(Math.floor(percent * width / 100), 0, width), right = clamp(width - left, 0, width), barStr = `${barColor(char.repeat(left))}${backgroundColor(char.repeat(right))}`, percentStr = `${percent.toString().padStart(3)}%`;
|
|
53
|
-
return terminalWidth >= 70 ? [
|
|
54
|
-
idColor(buildIcon),
|
|
55
|
-
id,
|
|
56
|
-
space,
|
|
57
|
-
barStr,
|
|
58
|
-
space,
|
|
59
|
-
percentStr,
|
|
60
|
-
space,
|
|
61
|
-
msgStr
|
|
62
|
-
].join('') : terminalWidth >= 40 ? [
|
|
63
|
-
idColor(buildIcon),
|
|
64
|
-
id,
|
|
65
|
-
space,
|
|
66
|
-
barStr,
|
|
67
|
-
space,
|
|
68
|
-
percentStr
|
|
69
|
-
].join('') : [
|
|
70
|
-
idColor(buildIcon),
|
|
71
|
-
id,
|
|
72
|
-
space,
|
|
73
|
-
percentStr
|
|
74
|
-
].join('');
|
|
75
|
-
};
|
|
76
|
-
var 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);
|
|
77
|
-
let create = (stream)=>{
|
|
78
|
-
let previousLineCount = 0, previousOutput = '', render = (str)=>{
|
|
79
|
-
let output = `${str}\n`;
|
|
80
|
-
output !== previousOutput && (previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length);
|
|
81
|
-
};
|
|
82
|
-
return render.clear = ()=>{
|
|
83
|
-
stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
|
|
84
|
-
}, render.done = ()=>{
|
|
85
|
-
previousOutput = '', previousLineCount = 0;
|
|
86
|
-
}, render;
|
|
87
28
|
};
|
|
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);
|
|
88
30
|
function _define_property(obj, key, value) {
|
|
89
31
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
90
32
|
value: value,
|
|
@@ -99,7 +41,7 @@ exports.ids = [
|
|
|
99
41
|
'yellow',
|
|
100
42
|
'blue',
|
|
101
43
|
'magenta'
|
|
102
|
-
],
|
|
44
|
+
], bus = new class {
|
|
103
45
|
update(state) {
|
|
104
46
|
let index = this.states.findIndex((i)=>i.id === state.id);
|
|
105
47
|
if (-1 === index) return void this.states.push(state);
|
|
@@ -114,9 +56,56 @@ exports.ids = [
|
|
|
114
56
|
return (null == (_i_id = i.id) ? void 0 : _i_id.length) ?? 0;
|
|
115
57
|
})) + 2, { columns = 70 } = process.stdout;
|
|
116
58
|
this.prevOutput = this.states.map((i, k)=>{
|
|
117
|
-
let bar =
|
|
59
|
+
let bar = ((option)=>{
|
|
60
|
+
let mergedOptions = {
|
|
61
|
+
...defaultOption,
|
|
62
|
+
...option
|
|
63
|
+
}, { total, done, buildIcon, errorIcon, errorInfo, width, current, color, bgColor, char, message, messageWidth, spaceWidth, messageColor, maxIdLen, hasErrors } = mergedOptions, space = ' '.repeat(spaceWidth), percent = clamp(Math.floor(current / total * 100), 0, 100), barColor = external_picocolors_default()[color], backgroundColor = external_picocolors_default()[bgColor], doneColor = hasErrors ? external_picocolors_default().red : barColor, idColor = done ? doneColor : barColor, id = mergedOptions.id ? idColor(((id, maxLen)=>{
|
|
64
|
+
let left = Math.floor((maxLen - id.length) / 2), right = maxLen - left - id.length;
|
|
65
|
+
return ' '.repeat(left) + id + ' '.repeat(right);
|
|
66
|
+
})(mergedOptions.id, maxIdLen)) : '', { columns: terminalWidth = 70 } = process.stdout;
|
|
67
|
+
if (done) {
|
|
68
|
+
if (hasErrors) {
|
|
69
|
+
let message = external_picocolors_default().bold(doneColor(errorInfo));
|
|
70
|
+
return terminalWidth >= 40 ? [
|
|
71
|
+
idColor(errorIcon),
|
|
72
|
+
id,
|
|
73
|
+
doneColor(`${space}${message}`)
|
|
74
|
+
].join('') : [
|
|
75
|
+
id,
|
|
76
|
+
doneColor(`${message}`)
|
|
77
|
+
].join('');
|
|
78
|
+
}
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
let msgStr = external_picocolors_default()[messageColor](cli_truncate_default()(message, messageWidth, {
|
|
82
|
+
position: 'start'
|
|
83
|
+
})), left = clamp(Math.floor(percent * width / 100), 0, width), right = clamp(width - left, 0, width), barStr = `${barColor(char.repeat(left))}${backgroundColor(char.repeat(right))}`, percentStr = `${percent.toString().padStart(3)}%`;
|
|
84
|
+
return terminalWidth >= 70 ? [
|
|
85
|
+
idColor(buildIcon),
|
|
86
|
+
id,
|
|
87
|
+
space,
|
|
88
|
+
barStr,
|
|
89
|
+
space,
|
|
90
|
+
percentStr,
|
|
91
|
+
space,
|
|
92
|
+
msgStr
|
|
93
|
+
].join('') : terminalWidth >= 40 ? [
|
|
94
|
+
idColor(buildIcon),
|
|
95
|
+
id,
|
|
96
|
+
space,
|
|
97
|
+
barStr,
|
|
98
|
+
space,
|
|
99
|
+
percentStr
|
|
100
|
+
].join('') : [
|
|
101
|
+
idColor(buildIcon),
|
|
102
|
+
id,
|
|
103
|
+
space,
|
|
104
|
+
percentStr
|
|
105
|
+
].join('');
|
|
106
|
+
})({
|
|
118
107
|
maxIdLen,
|
|
119
|
-
color: i.color ??
|
|
108
|
+
color: i.color ?? colorList[k % colorList.length],
|
|
120
109
|
...i
|
|
121
110
|
});
|
|
122
111
|
return bar ? cli_truncate_default()(bar, columns, {
|
|
@@ -131,21 +120,21 @@ exports.ids = [
|
|
|
131
120
|
this.log.clear(), this.log.done();
|
|
132
121
|
}
|
|
133
122
|
constructor(){
|
|
134
|
-
_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 =
|
|
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)=>{
|
|
135
134
|
this.writeToStd(type, data);
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
|
-
}()
|
|
139
|
-
let prevPercentage = 0;
|
|
140
|
-
return (percentage)=>{
|
|
141
|
-
if (0 === percentage || 1 === percentage) return prevPercentage = 0, percentage;
|
|
142
|
-
if (percentage <= prevPercentage) {
|
|
143
|
-
let step = 0;
|
|
144
|
-
return prevPercentage < 0.3 ? step = 0.001 : prevPercentage < 0.6 ? step = 0.002 : prevPercentage < 0.8 ? step = 0.004 : prevPercentage < 0.99 && (step = 0.002), prevPercentage += step;
|
|
145
|
-
}
|
|
146
|
-
return prevPercentage = percentage, percentage;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
137
|
+
}();
|
|
149
138
|
function ProgressPlugin_define_property(obj, key, value) {
|
|
150
139
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
151
140
|
value: value,
|
|
@@ -172,15 +161,28 @@ exports.ids = [
|
|
|
172
161
|
});
|
|
173
162
|
}
|
|
174
163
|
constructor(options){
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
164
|
+
let { id = 'Rsbuild' } = options, nonTTYLogger = function() {
|
|
165
|
+
let prevPercentage = 0;
|
|
166
|
+
return {
|
|
167
|
+
log: ({ id, done, current, hasErrors, compileTime })=>{
|
|
168
|
+
let suffix = external_picocolors_default().gray(`(${id})`);
|
|
169
|
+
if (done) {
|
|
170
|
+
if (100 === prevPercentage) return;
|
|
171
|
+
prevPercentage = 100, hasErrors ? core_.logger.error(`built failed in ${compileTime} ${suffix}`) : core_.logger.ready(`built in ${compileTime} ${suffix}`);
|
|
172
|
+
} else current - prevPercentage > 10 && (prevPercentage = current, core_.logger.info(`build progress: ${current.toFixed(0)}% ${suffix}`));
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}(), friendlyPercentage = (()=>{
|
|
176
|
+
let prevPercentage = 0;
|
|
177
|
+
return (percentage)=>{
|
|
178
|
+
if (0 === percentage || 1 === percentage) return prevPercentage = 0, percentage;
|
|
179
|
+
if (percentage <= prevPercentage) {
|
|
180
|
+
let step = 0;
|
|
181
|
+
return prevPercentage < 0.3 ? step = 0.001 : prevPercentage < 0.6 ? step = 0.002 : prevPercentage < 0.8 ? step = 0.004 : prevPercentage < 0.99 && (step = 0.002), prevPercentage += step;
|
|
182
|
+
}
|
|
183
|
+
return prevPercentage = percentage, percentage;
|
|
184
|
+
};
|
|
185
|
+
})();
|
|
184
186
|
super({
|
|
185
187
|
activeModules: !1,
|
|
186
188
|
entries: !0,
|
package/dist/997.cjs
CHANGED
|
@@ -17,20 +17,7 @@ exports.ids = [
|
|
|
17
17
|
let clear = '';
|
|
18
18
|
for(let i = 0; i < count; i++)clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
|
|
19
19
|
return count && (clear += ansiEscapes.cursorLeft), clear;
|
|
20
|
-
}, ansiEscapes.eraseEndLine = "\x1b[K", ansiEscapes.eraseStartLine = "\x1b[1K", ansiEscapes.eraseLine = "\x1b[2K", ansiEscapes.eraseDown = "\x1b[J", ansiEscapes.eraseUp = "\x1b[1J", ansiEscapes.eraseScreen = "\x1b[2J", ansiEscapes.scrollUp = "\x1b[S", ansiEscapes.scrollDown = "\x1b[T", ansiEscapes.clearScreen = '\u001Bc', ansiEscapes.clearTerminal = 'win32' === process.platform ? `${ansiEscapes.eraseScreen}\u001B[0f` : `${ansiEscapes.eraseScreen}\u001B[3J\u001B[H`, ansiEscapes.beep = '\u0007', ansiEscapes.link = (text, url)=>
|
|
21
|
-
'\u001B]',
|
|
22
|
-
'8',
|
|
23
|
-
';',
|
|
24
|
-
';',
|
|
25
|
-
url,
|
|
26
|
-
'\u0007',
|
|
27
|
-
text,
|
|
28
|
-
'\u001B]',
|
|
29
|
-
'8',
|
|
30
|
-
';',
|
|
31
|
-
';',
|
|
32
|
-
'\u0007'
|
|
33
|
-
].join(''), ansiEscapes.image = (buffer, options = {})=>{
|
|
20
|
+
}, ansiEscapes.eraseEndLine = "\x1b[K", ansiEscapes.eraseStartLine = "\x1b[1K", ansiEscapes.eraseLine = "\x1b[2K", ansiEscapes.eraseDown = "\x1b[J", ansiEscapes.eraseUp = "\x1b[1J", ansiEscapes.eraseScreen = "\x1b[2J", ansiEscapes.scrollUp = "\x1b[S", ansiEscapes.scrollDown = "\x1b[T", ansiEscapes.clearScreen = '\u001Bc', ansiEscapes.clearTerminal = 'win32' === process.platform ? `${ansiEscapes.eraseScreen}\u001B[0f` : `${ansiEscapes.eraseScreen}\u001B[3J\u001B[H`, ansiEscapes.beep = '\u0007', ansiEscapes.link = (text, url)=>"\x1b]8;;" + url + '\u0007' + text + "\x1b]8;;\x07", ansiEscapes.image = (buffer, options = {})=>{
|
|
34
21
|
let ret = `\u001B]1337;File=inline=1`;
|
|
35
22
|
return options.width && (ret += `;width=${options.width}`), options.height && (ret += `;height=${options.height}`), !1 === options.preserveAspectRatio && (ret += ';preserveAspectRatio=0'), ret + ':' + buffer.toString('base64') + '\u0007';
|
|
36
23
|
}, ansiEscapes.iTerm = {
|
|
@@ -692,7 +679,7 @@ exports.ids = [
|
|
|
692
679
|
0xFF & integer
|
|
693
680
|
];
|
|
694
681
|
}, convert.rgb.hcg = function(rgb) {
|
|
695
|
-
let grayscale,
|
|
682
|
+
let grayscale, r = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, max = Math.max(Math.max(r, g), b), min = Math.min(Math.min(r, g), b), chroma = max - min;
|
|
696
683
|
return grayscale = chroma < 1 ? min / (1 - chroma) : 0, [
|
|
697
684
|
360 * ((chroma <= 0 ? 0 : max === r ? (g - b) / chroma % 6 : max === g ? 2 + (b - r) / chroma : 4 + (r - g) / chroma) / 6 % 1),
|
|
698
685
|
100 * chroma,
|
package/dist/997.js
CHANGED
|
@@ -17,20 +17,7 @@ export const __webpack_modules__ = {
|
|
|
17
17
|
let clear = '';
|
|
18
18
|
for(let i = 0; i < count; i++)clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
|
|
19
19
|
return count && (clear += ansiEscapes.cursorLeft), clear;
|
|
20
|
-
}, ansiEscapes.eraseEndLine = "\x1b[K", ansiEscapes.eraseStartLine = "\x1b[1K", ansiEscapes.eraseLine = "\x1b[2K", ansiEscapes.eraseDown = "\x1b[J", ansiEscapes.eraseUp = "\x1b[1J", ansiEscapes.eraseScreen = "\x1b[2J", ansiEscapes.scrollUp = "\x1b[S", ansiEscapes.scrollDown = "\x1b[T", ansiEscapes.clearScreen = '\u001Bc', ansiEscapes.clearTerminal = 'win32' === process.platform ? `${ansiEscapes.eraseScreen}\u001B[0f` : `${ansiEscapes.eraseScreen}\u001B[3J\u001B[H`, ansiEscapes.beep = '\u0007', ansiEscapes.link = (text, url)=>
|
|
21
|
-
'\u001B]',
|
|
22
|
-
'8',
|
|
23
|
-
';',
|
|
24
|
-
';',
|
|
25
|
-
url,
|
|
26
|
-
'\u0007',
|
|
27
|
-
text,
|
|
28
|
-
'\u001B]',
|
|
29
|
-
'8',
|
|
30
|
-
';',
|
|
31
|
-
';',
|
|
32
|
-
'\u0007'
|
|
33
|
-
].join(''), ansiEscapes.image = (buffer, options = {})=>{
|
|
20
|
+
}, ansiEscapes.eraseEndLine = "\x1b[K", ansiEscapes.eraseStartLine = "\x1b[1K", ansiEscapes.eraseLine = "\x1b[2K", ansiEscapes.eraseDown = "\x1b[J", ansiEscapes.eraseUp = "\x1b[1J", ansiEscapes.eraseScreen = "\x1b[2J", ansiEscapes.scrollUp = "\x1b[S", ansiEscapes.scrollDown = "\x1b[T", ansiEscapes.clearScreen = '\u001Bc', ansiEscapes.clearTerminal = 'win32' === process.platform ? `${ansiEscapes.eraseScreen}\u001B[0f` : `${ansiEscapes.eraseScreen}\u001B[3J\u001B[H`, ansiEscapes.beep = '\u0007', ansiEscapes.link = (text, url)=>"\x1b]8;;" + url + '\u0007' + text + "\x1b]8;;\x07", ansiEscapes.image = (buffer, options = {})=>{
|
|
34
21
|
let ret = `\u001B]1337;File=inline=1`;
|
|
35
22
|
return options.width && (ret += `;width=${options.width}`), options.height && (ret += `;height=${options.height}`), !1 === options.preserveAspectRatio && (ret += ';preserveAspectRatio=0'), ret + ':' + buffer.toString('base64') + '\u0007';
|
|
36
23
|
}, ansiEscapes.iTerm = {
|
|
@@ -688,7 +675,7 @@ export const __webpack_modules__ = {
|
|
|
688
675
|
0xFF & integer
|
|
689
676
|
];
|
|
690
677
|
}, convert.rgb.hcg = function(rgb) {
|
|
691
|
-
let grayscale,
|
|
678
|
+
let grayscale, r = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, max = Math.max(Math.max(r, g), b), min = Math.min(Math.min(r, g), b), chroma = max - min;
|
|
692
679
|
return grayscale = chroma < 1 ? min / (1 - chroma) : 0, [
|
|
693
680
|
360 * ((chroma <= 0 ? 0 : max === r ? (g - b) / chroma % 6 : max === g ? 2 + (b - r) / chroma : 4 + (r - g) / chroma) / 6 % 1),
|
|
694
681
|
100 * chroma,
|
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ var __webpack_modules__ = {
|
|
|
13
13
|
stream: function(module) {
|
|
14
14
|
module.exports = require("stream");
|
|
15
15
|
},
|
|
16
|
-
"webpack?
|
|
16
|
+
"webpack?2a1e": function(module) {
|
|
17
17
|
module.exports = require("webpack");
|
|
18
18
|
},
|
|
19
19
|
"copy-webpack-plugin": function(module) {
|
|
@@ -36,7 +36,7 @@ var __webpack_modules__ = {
|
|
|
36
36
|
return module;
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
"webpack?
|
|
39
|
+
"webpack?5a4d": function(module) {
|
|
40
40
|
module.exports = import("webpack").then(function(module) {
|
|
41
41
|
return module;
|
|
42
42
|
});
|
|
@@ -71,14 +71,14 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
71
71
|
}, __webpack_require__.nmd = (module)=>(module.paths = [], module.children || (module.children = []), module), (()=>{
|
|
72
72
|
var installedChunks = {
|
|
73
73
|
980: 1
|
|
74
|
-
}, installChunk = (chunk)=>{
|
|
75
|
-
var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;
|
|
76
|
-
for(var moduleId in moreModules)__webpack_require__.o(moreModules, moduleId) && (__webpack_require__.m[moduleId] = moreModules[moduleId]);
|
|
77
|
-
runtime && runtime(__webpack_require__);
|
|
78
|
-
for(var i = 0; i < chunkIds.length; i++)installedChunks[chunkIds[i]] = 1;
|
|
79
74
|
};
|
|
80
75
|
__webpack_require__.f.require = (chunkId, promises)=>{
|
|
81
|
-
installedChunks[chunkId] ||
|
|
76
|
+
installedChunks[chunkId] || ((chunk)=>{
|
|
77
|
+
var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;
|
|
78
|
+
for(var moduleId in moreModules)__webpack_require__.o(moreModules, moduleId) && (__webpack_require__.m[moduleId] = moreModules[moduleId]);
|
|
79
|
+
runtime && runtime(__webpack_require__);
|
|
80
|
+
for(var i = 0; i < chunkIds.length; i++)installedChunks[chunkIds[i]] = 1;
|
|
81
|
+
})(require("./" + __webpack_require__.u(chunkId)));
|
|
82
82
|
};
|
|
83
83
|
})();
|
|
84
84
|
var __webpack_exports__ = {};
|
|
@@ -89,41 +89,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
89
89
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
90
90
|
let MultiStats_js_namespaceObject = require("webpack/lib/MultiStats.js");
|
|
91
91
|
var MultiStats_js_default = __webpack_require__.n(MultiStats_js_namespaceObject);
|
|
92
|
-
let external_node_path_namespaceObject = require("node:path"), getInspectOutputPath = (context, inspectOptions)=>inspectOptions.outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions.outputPath) ? inspectOptions.outputPath : (0, external_node_path_namespaceObject.join)(context.distPath, inspectOptions.outputPath) : (0, external_node_path_namespaceObject.join)(context.distPath, '.rsbuild');
|
|
93
|
-
async function inspectConfig({ helpers, context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions = {} }) {
|
|
94
|
-
inspectOptions.mode ? process.env.NODE_ENV = inspectOptions.mode : process.env.NODE_ENV || (process.env.NODE_ENV = 'development');
|
|
95
|
-
let webpackConfigs = bundlerConfigs || (await initConfigs({
|
|
96
|
-
context,
|
|
97
|
-
pluginManager,
|
|
98
|
-
rsbuildOptions,
|
|
99
|
-
helpers
|
|
100
|
-
})).webpackConfigs, rawBundlerConfigs = webpackConfigs.map((config, index)=>({
|
|
101
|
-
name: config.name || String(index),
|
|
102
|
-
content: helpers.stringifyConfig(config, inspectOptions.verbose)
|
|
103
|
-
})), { rsbuildConfig, rawRsbuildConfig, environmentConfigs, rawEnvironmentConfigs } = helpers.getRsbuildInspectConfig({
|
|
104
|
-
normalizedConfig: context.normalizedConfig,
|
|
105
|
-
inspectOptions,
|
|
106
|
-
pluginManager
|
|
107
|
-
}), outputPath = getInspectOutputPath(context, inspectOptions);
|
|
108
|
-
return inspectOptions.writeToDisk && await helpers.outputInspectConfigFiles({
|
|
109
|
-
rawBundlerConfigs,
|
|
110
|
-
rawEnvironmentConfigs,
|
|
111
|
-
inspectOptions: {
|
|
112
|
-
...inspectOptions,
|
|
113
|
-
outputPath
|
|
114
|
-
},
|
|
115
|
-
configType: 'webpack'
|
|
116
|
-
}), {
|
|
117
|
-
rsbuildConfig: rawRsbuildConfig,
|
|
118
|
-
environmentConfigs: rawEnvironmentConfigs.map((r)=>r.content),
|
|
119
|
-
bundlerConfigs: rawBundlerConfigs.map((r)=>r.content),
|
|
120
|
-
origin: {
|
|
121
|
-
rsbuildConfig,
|
|
122
|
-
environmentConfigs,
|
|
123
|
-
bundlerConfigs: webpackConfigs
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
92
|
let external_reduce_configs_namespaceObject = require("reduce-configs"), castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
128
93
|
arr
|
|
129
94
|
];
|
|
@@ -158,7 +123,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
158
123
|
})), core_.logger.debug('modify webpack config done'), modifiedConfig;
|
|
159
124
|
}
|
|
160
125
|
async function getChainUtils(target, environment, helpers) {
|
|
161
|
-
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?
|
|
126
|
+
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?5a4d"));
|
|
162
127
|
return {
|
|
163
128
|
...helpers.getChainUtils(target, environment),
|
|
164
129
|
name: ({
|
|
@@ -171,7 +136,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
171
136
|
};
|
|
172
137
|
}
|
|
173
138
|
async function generateWebpackConfig({ target, context, environment, helpers }) {
|
|
174
|
-
let chainUtils = await getChainUtils(target, context.environments[environment], helpers), { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?
|
|
139
|
+
let chainUtils = await getChainUtils(target, context.environments[environment], helpers), { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?5a4d")), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, SourceMapDevToolPlugin, HotModuleReplacementPlugin } = webpack, bundlerChain = await helpers.modifyBundlerChain(context, {
|
|
175
140
|
...chainUtils,
|
|
176
141
|
bundler: {
|
|
177
142
|
BannerPlugin,
|
|
@@ -196,16 +161,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
196
161
|
})));
|
|
197
162
|
if ('verbose' === core_.logger.level) {
|
|
198
163
|
let inspect = async ()=>{
|
|
199
|
-
await inspectConfig({
|
|
164
|
+
await helpers.inspectConfig({
|
|
200
165
|
context,
|
|
166
|
+
bundler: 'webpack',
|
|
201
167
|
pluginManager,
|
|
202
168
|
inspectOptions: {
|
|
203
169
|
verbose: !0,
|
|
204
170
|
writeToDisk: !0
|
|
205
171
|
},
|
|
206
172
|
rsbuildOptions,
|
|
207
|
-
bundlerConfigs: webpackConfigs
|
|
208
|
-
helpers
|
|
173
|
+
bundlerConfigs: webpackConfigs
|
|
209
174
|
});
|
|
210
175
|
};
|
|
211
176
|
context.hooks.onBeforeBuild.tap(async ({ isFirstCompile })=>{
|
|
@@ -223,17 +188,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
223
188
|
bundlerConfigs: webpackConfigs,
|
|
224
189
|
environments: context.environments
|
|
225
190
|
});
|
|
226
|
-
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?
|
|
227
|
-
|
|
191
|
+
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?5a4d")), compiler = webpack(1 === webpackConfigs.length ? webpackConfigs[0] : webpackConfigs);
|
|
192
|
+
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
193
|
+
var stats1 = stats;
|
|
194
|
+
let statsOptions = helpers.getStatsOptions(compiler), statsJson = stats1.toJson({
|
|
228
195
|
moduleTrace: !0,
|
|
229
196
|
children: !0,
|
|
230
197
|
preset: 'errors-warnings',
|
|
231
198
|
...statsOptions
|
|
232
|
-
}), { message, level } = helpers.formatStats(statsJson,
|
|
199
|
+
}), { message, level } = helpers.formatStats(statsJson, stats1.hasErrors());
|
|
233
200
|
'error' === level ? core_.logger.error(message) : 'warning' === level && core_.logger.warn(message);
|
|
234
|
-
};
|
|
235
|
-
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
236
|
-
done(stats);
|
|
237
201
|
}), 'dev' === context.action && helpers.registerDevHook({
|
|
238
202
|
compiler,
|
|
239
203
|
context,
|
|
@@ -294,61 +258,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
294
258
|
}
|
|
295
259
|
]);
|
|
296
260
|
}
|
|
297
|
-
let
|
|
298
|
-
let
|
|
299
|
-
return mainFields.length ? mainFields : !function(target) {
|
|
300
|
-
return castArray(target).includes('web') || target.includes('web-worker');
|
|
301
|
-
}(target) ? [
|
|
302
|
-
'module',
|
|
303
|
-
'main'
|
|
304
|
-
] : [
|
|
305
|
-
'browser',
|
|
306
|
-
'module',
|
|
307
|
-
'main'
|
|
308
|
-
];
|
|
309
|
-
}, pluginAdaptor = (helpers)=>({
|
|
310
|
-
name: 'rsbuild-webpack:adaptor',
|
|
311
|
-
setup (api) {
|
|
312
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
313
|
-
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
314
|
-
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
315
|
-
chain,
|
|
316
|
-
CHAIN_ID,
|
|
317
|
-
configFile: tsconfigPath,
|
|
318
|
-
mainFields: getMainFields(chain, target),
|
|
319
|
-
extensions: chain.resolve.extensions.values()
|
|
320
|
-
});
|
|
321
|
-
let progress = config.dev.progressBar ?? !0;
|
|
322
|
-
if (progress) {
|
|
323
|
-
let { ProgressPlugin } = await Promise.all([
|
|
324
|
-
__webpack_require__.e("997"),
|
|
325
|
-
__webpack_require__.e("818")
|
|
326
|
-
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
327
|
-
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
328
|
-
{
|
|
329
|
-
id: environment.name,
|
|
330
|
-
prettyTime: helpers.prettyTime,
|
|
331
|
-
...!0 === progress ? {} : progress
|
|
332
|
-
}
|
|
333
|
-
]);
|
|
334
|
-
}
|
|
335
|
-
let { copy } = config.output;
|
|
336
|
-
if (copy) {
|
|
337
|
-
let { default: CopyPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "copy-webpack-plugin")), options = Array.isArray(copy) ? {
|
|
338
|
-
patterns: copy
|
|
339
|
-
} : copy;
|
|
340
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
341
|
-
options
|
|
342
|
-
]);
|
|
343
|
-
}
|
|
344
|
-
}), api.modifyWebpackConfig(async (config)=>{
|
|
345
|
-
var _config_plugins, _config_plugins1;
|
|
346
|
-
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
347
|
-
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'));
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}), webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
351
|
-
let { default: cssExtractPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "mini-css-extract-plugin"));
|
|
261
|
+
let webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
262
|
+
let helpers1, { default: cssExtractPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "mini-css-extract-plugin"));
|
|
352
263
|
if (helpers.setCssExtractPlugin(cssExtractPlugin), helpers.setHTMLPlugin) {
|
|
353
264
|
let { default: htmlPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "html-webpack-plugin"));
|
|
354
265
|
helpers.setHTMLPlugin(htmlPlugin);
|
|
@@ -360,7 +271,59 @@ for(var __webpack_i__ in (()=>{
|
|
|
360
271
|
helpers
|
|
361
272
|
})).compiler;
|
|
362
273
|
return pluginManager.addPlugins([
|
|
363
|
-
|
|
274
|
+
(helpers1 = helpers, {
|
|
275
|
+
name: 'rsbuild-webpack:adaptor',
|
|
276
|
+
setup (api) {
|
|
277
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
278
|
+
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
279
|
+
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
280
|
+
chain,
|
|
281
|
+
CHAIN_ID,
|
|
282
|
+
configFile: tsconfigPath,
|
|
283
|
+
mainFields: ((chain, target)=>{
|
|
284
|
+
var target1;
|
|
285
|
+
let mainFields = chain.resolve.mainFields.values();
|
|
286
|
+
return mainFields.length ? mainFields : castArray(target1 = target).includes('web') || target1.includes('web-worker') ? [
|
|
287
|
+
'browser',
|
|
288
|
+
'module',
|
|
289
|
+
'main'
|
|
290
|
+
] : [
|
|
291
|
+
'module',
|
|
292
|
+
'main'
|
|
293
|
+
];
|
|
294
|
+
})(chain, target),
|
|
295
|
+
extensions: chain.resolve.extensions.values()
|
|
296
|
+
});
|
|
297
|
+
let progress = config.dev.progressBar ?? !0;
|
|
298
|
+
if (progress) {
|
|
299
|
+
let { ProgressPlugin } = await Promise.all([
|
|
300
|
+
__webpack_require__.e("997"),
|
|
301
|
+
__webpack_require__.e("818")
|
|
302
|
+
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
303
|
+
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
304
|
+
{
|
|
305
|
+
id: environment.name,
|
|
306
|
+
prettyTime: helpers1.prettyTime,
|
|
307
|
+
...!0 === progress ? {} : progress
|
|
308
|
+
}
|
|
309
|
+
]);
|
|
310
|
+
}
|
|
311
|
+
let { copy } = config.output;
|
|
312
|
+
if (copy) {
|
|
313
|
+
let { default: CopyPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "copy-webpack-plugin")), options = Array.isArray(copy) ? {
|
|
314
|
+
patterns: copy
|
|
315
|
+
} : copy;
|
|
316
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
317
|
+
options
|
|
318
|
+
]);
|
|
319
|
+
}
|
|
320
|
+
}), api.modifyWebpackConfig(async (config)=>{
|
|
321
|
+
var _config_plugins, _config_plugins1;
|
|
322
|
+
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
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'));
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
})
|
|
364
327
|
]), {
|
|
365
328
|
bundler: 'webpack',
|
|
366
329
|
createCompiler,
|
|
@@ -401,13 +364,22 @@ for(var __webpack_i__ in (()=>{
|
|
|
401
364
|
rsbuildOptions,
|
|
402
365
|
helpers
|
|
403
366
|
}, options),
|
|
404
|
-
inspectConfig
|
|
367
|
+
async inspectConfig (inspectOptions) {
|
|
368
|
+
let bundlerConfigs = (await initConfigs({
|
|
405
369
|
context,
|
|
406
370
|
pluginManager,
|
|
407
371
|
rsbuildOptions,
|
|
408
|
-
inspectOptions,
|
|
409
372
|
helpers
|
|
410
|
-
})
|
|
373
|
+
})).webpackConfigs;
|
|
374
|
+
return await helpers.inspectConfig({
|
|
375
|
+
context,
|
|
376
|
+
pluginManager,
|
|
377
|
+
bundler: 'webpack',
|
|
378
|
+
bundlerConfigs,
|
|
379
|
+
rsbuildOptions,
|
|
380
|
+
inspectOptions
|
|
381
|
+
});
|
|
382
|
+
}
|
|
411
383
|
};
|
|
412
384
|
};
|
|
413
385
|
})(), exports.webpackProvider = __webpack_exports__.webpackProvider, __webpack_exports__)-1 === [
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { webpackProvider } from './provider.js';
|
|
2
|
-
export type {
|
|
2
|
+
export type { WebpackConfig, webpack, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__ from "node:console
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_stream__ from "stream";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_webpack__ from "webpack";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
6
|
+
import MultiStats from "webpack/lib/MultiStats.js";
|
|
7
|
+
import { reduceConfigsWithContext } from "reduce-configs";
|
|
8
|
+
import node_fs from "node:fs";
|
|
10
9
|
var installedChunks, installChunk, __webpack_modules__ = {
|
|
11
10
|
"@rsbuild/core": function(module) {
|
|
12
11
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
@@ -68,41 +67,6 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
68
67
|
}
|
|
69
68
|
};
|
|
70
69
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
71
|
-
let getInspectOutputPath = (context, inspectOptions)=>inspectOptions.outputPath ? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(inspectOptions.outputPath) ? inspectOptions.outputPath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(context.distPath, inspectOptions.outputPath) : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(context.distPath, '.rsbuild');
|
|
72
|
-
async function inspectConfig({ helpers, context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions = {} }) {
|
|
73
|
-
inspectOptions.mode ? process.env.NODE_ENV = inspectOptions.mode : process.env.NODE_ENV || (process.env.NODE_ENV = 'development');
|
|
74
|
-
let webpackConfigs = bundlerConfigs || (await initConfigs({
|
|
75
|
-
context,
|
|
76
|
-
pluginManager,
|
|
77
|
-
rsbuildOptions,
|
|
78
|
-
helpers
|
|
79
|
-
})).webpackConfigs, rawBundlerConfigs = webpackConfigs.map((config, index)=>({
|
|
80
|
-
name: config.name || String(index),
|
|
81
|
-
content: helpers.stringifyConfig(config, inspectOptions.verbose)
|
|
82
|
-
})), { rsbuildConfig, rawRsbuildConfig, environmentConfigs, rawEnvironmentConfigs } = helpers.getRsbuildInspectConfig({
|
|
83
|
-
normalizedConfig: context.normalizedConfig,
|
|
84
|
-
inspectOptions,
|
|
85
|
-
pluginManager
|
|
86
|
-
}), outputPath = getInspectOutputPath(context, inspectOptions);
|
|
87
|
-
return inspectOptions.writeToDisk && await helpers.outputInspectConfigFiles({
|
|
88
|
-
rawBundlerConfigs,
|
|
89
|
-
rawEnvironmentConfigs,
|
|
90
|
-
inspectOptions: {
|
|
91
|
-
...inspectOptions,
|
|
92
|
-
outputPath
|
|
93
|
-
},
|
|
94
|
-
configType: 'webpack'
|
|
95
|
-
}), {
|
|
96
|
-
rsbuildConfig: rawRsbuildConfig,
|
|
97
|
-
environmentConfigs: rawEnvironmentConfigs.map((r)=>r.content),
|
|
98
|
-
bundlerConfigs: rawBundlerConfigs.map((r)=>r.content),
|
|
99
|
-
origin: {
|
|
100
|
-
rsbuildConfig,
|
|
101
|
-
environmentConfigs,
|
|
102
|
-
bundlerConfigs: webpackConfigs
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
70
|
let castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
107
71
|
arr
|
|
108
72
|
];
|
|
@@ -129,7 +93,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
129
93
|
utils
|
|
130
94
|
]
|
|
131
95
|
});
|
|
132
|
-
return (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.webpack) && (modifiedConfig =
|
|
96
|
+
return (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.webpack) && (modifiedConfig = reduceConfigsWithContext({
|
|
133
97
|
initial: modifiedConfig,
|
|
134
98
|
config: utils.environment.config.tools.webpack,
|
|
135
99
|
ctx: utils,
|
|
@@ -175,16 +139,16 @@ async function initConfigs({ context, pluginManager, rsbuildOptions, helpers })
|
|
|
175
139
|
})));
|
|
176
140
|
if ('verbose' === core_.logger.level) {
|
|
177
141
|
let inspect = async ()=>{
|
|
178
|
-
await inspectConfig({
|
|
142
|
+
await helpers.inspectConfig({
|
|
179
143
|
context,
|
|
144
|
+
bundler: 'webpack',
|
|
180
145
|
pluginManager,
|
|
181
146
|
inspectOptions: {
|
|
182
147
|
verbose: !0,
|
|
183
148
|
writeToDisk: !0
|
|
184
149
|
},
|
|
185
150
|
rsbuildOptions,
|
|
186
|
-
bundlerConfigs: webpackConfigs
|
|
187
|
-
helpers
|
|
151
|
+
bundlerConfigs: webpackConfigs
|
|
188
152
|
});
|
|
189
153
|
};
|
|
190
154
|
context.hooks.onBeforeBuild.tap(async ({ isFirstCompile })=>{
|
|
@@ -202,7 +166,8 @@ async function createCompiler_createCompiler(options) {
|
|
|
202
166
|
bundlerConfigs: webpackConfigs,
|
|
203
167
|
environments: context.environments
|
|
204
168
|
});
|
|
205
|
-
let { default: webpack } = await import("webpack"), compiler = webpack(1 === webpackConfigs.length ? webpackConfigs[0] : webpackConfigs)
|
|
169
|
+
let { default: webpack } = await import("webpack"), compiler = webpack(1 === webpackConfigs.length ? webpackConfigs[0] : webpackConfigs);
|
|
170
|
+
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
206
171
|
let statsOptions = helpers.getStatsOptions(compiler), statsJson = stats.toJson({
|
|
207
172
|
moduleTrace: !0,
|
|
208
173
|
children: !0,
|
|
@@ -210,14 +175,11 @@ async function createCompiler_createCompiler(options) {
|
|
|
210
175
|
...statsOptions
|
|
211
176
|
}), { message, level } = helpers.formatStats(statsJson, stats.hasErrors());
|
|
212
177
|
'error' === level ? core_.logger.error(message) : 'warning' === level && core_.logger.warn(message);
|
|
213
|
-
};
|
|
214
|
-
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
215
|
-
done(stats);
|
|
216
178
|
}), 'dev' === context.action && helpers.registerDevHook({
|
|
217
179
|
compiler,
|
|
218
180
|
context,
|
|
219
181
|
bundlerConfigs: webpackConfigs,
|
|
220
|
-
MultiStatsCtor:
|
|
182
|
+
MultiStatsCtor: MultiStats
|
|
221
183
|
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
222
184
|
compiler,
|
|
223
185
|
environments: context.environments
|
|
@@ -238,7 +200,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
238
200
|
bundlerConfigs: bundlerConfigs,
|
|
239
201
|
compiler,
|
|
240
202
|
isWatch: !!watch,
|
|
241
|
-
MultiStatsCtor:
|
|
203
|
+
MultiStatsCtor: MultiStats
|
|
242
204
|
}), watch) return compiler.watch({}, (err)=>{
|
|
243
205
|
err && core_.logger.error(err);
|
|
244
206
|
}), {
|
|
@@ -272,58 +234,7 @@ async function applyTsConfigPathsPlugin({ chain, CHAIN_ID, mainFields, extension
|
|
|
272
234
|
}
|
|
273
235
|
]);
|
|
274
236
|
}
|
|
275
|
-
let
|
|
276
|
-
let mainFields = chain.resolve.mainFields.values();
|
|
277
|
-
return mainFields.length ? mainFields : castArray(target).includes('web') || target.includes('web-worker') ? [
|
|
278
|
-
'browser',
|
|
279
|
-
'module',
|
|
280
|
-
'main'
|
|
281
|
-
] : [
|
|
282
|
-
'module',
|
|
283
|
-
'main'
|
|
284
|
-
];
|
|
285
|
-
}, pluginAdaptor = (helpers)=>({
|
|
286
|
-
name: 'rsbuild-webpack:adaptor',
|
|
287
|
-
setup (api) {
|
|
288
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
289
|
-
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
290
|
-
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
291
|
-
chain,
|
|
292
|
-
CHAIN_ID,
|
|
293
|
-
configFile: tsconfigPath,
|
|
294
|
-
mainFields: getMainFields(chain, target),
|
|
295
|
-
extensions: chain.resolve.extensions.values()
|
|
296
|
-
});
|
|
297
|
-
let progress = config.dev.progressBar ?? !0;
|
|
298
|
-
if (progress) {
|
|
299
|
-
let { ProgressPlugin } = await Promise.all([
|
|
300
|
-
__webpack_require__.e("997"),
|
|
301
|
-
__webpack_require__.e("812")
|
|
302
|
-
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
303
|
-
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
304
|
-
{
|
|
305
|
-
id: environment.name,
|
|
306
|
-
prettyTime: helpers.prettyTime,
|
|
307
|
-
...!0 === progress ? {} : progress
|
|
308
|
-
}
|
|
309
|
-
]);
|
|
310
|
-
}
|
|
311
|
-
let { copy } = config.output;
|
|
312
|
-
if (copy) {
|
|
313
|
-
let { default: CopyPlugin } = await import("copy-webpack-plugin"), options = Array.isArray(copy) ? {
|
|
314
|
-
patterns: copy
|
|
315
|
-
} : copy;
|
|
316
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
317
|
-
options
|
|
318
|
-
]);
|
|
319
|
-
}
|
|
320
|
-
}), api.modifyWebpackConfig(async (config)=>{
|
|
321
|
-
var _config_plugins, _config_plugins1;
|
|
322
|
-
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
323
|
-
copyPlugin && copyPlugin.patterns.every((pattern)=>'string' != typeof pattern && pattern.context && !__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.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'));
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}), webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
237
|
+
let webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
327
238
|
let { default: cssExtractPlugin } = await import("mini-css-extract-plugin");
|
|
328
239
|
if (helpers.setCssExtractPlugin(cssExtractPlugin), helpers.setHTMLPlugin) {
|
|
329
240
|
let { default: htmlPlugin } = await import("html-webpack-plugin");
|
|
@@ -336,7 +247,58 @@ let getMainFields = (chain, target)=>{
|
|
|
336
247
|
helpers
|
|
337
248
|
})).compiler;
|
|
338
249
|
return pluginManager.addPlugins([
|
|
339
|
-
|
|
250
|
+
{
|
|
251
|
+
name: 'rsbuild-webpack:adaptor',
|
|
252
|
+
setup (api) {
|
|
253
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
254
|
+
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
255
|
+
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
256
|
+
chain,
|
|
257
|
+
CHAIN_ID,
|
|
258
|
+
configFile: tsconfigPath,
|
|
259
|
+
mainFields: ((chain, target)=>{
|
|
260
|
+
let mainFields = chain.resolve.mainFields.values();
|
|
261
|
+
return mainFields.length ? mainFields : castArray(target).includes('web') || target.includes('web-worker') ? [
|
|
262
|
+
'browser',
|
|
263
|
+
'module',
|
|
264
|
+
'main'
|
|
265
|
+
] : [
|
|
266
|
+
'module',
|
|
267
|
+
'main'
|
|
268
|
+
];
|
|
269
|
+
})(chain, target),
|
|
270
|
+
extensions: chain.resolve.extensions.values()
|
|
271
|
+
});
|
|
272
|
+
let progress = config.dev.progressBar ?? !0;
|
|
273
|
+
if (progress) {
|
|
274
|
+
let { ProgressPlugin } = await Promise.all([
|
|
275
|
+
__webpack_require__.e("997"),
|
|
276
|
+
__webpack_require__.e("812")
|
|
277
|
+
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
278
|
+
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
279
|
+
{
|
|
280
|
+
id: environment.name,
|
|
281
|
+
prettyTime: helpers.prettyTime,
|
|
282
|
+
...!0 === progress ? {} : progress
|
|
283
|
+
}
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
286
|
+
let { copy } = config.output;
|
|
287
|
+
if (copy) {
|
|
288
|
+
let { default: CopyPlugin } = await import("copy-webpack-plugin"), options = Array.isArray(copy) ? {
|
|
289
|
+
patterns: copy
|
|
290
|
+
} : copy;
|
|
291
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
292
|
+
options
|
|
293
|
+
]);
|
|
294
|
+
}
|
|
295
|
+
}), api.modifyWebpackConfig(async (config)=>{
|
|
296
|
+
var _config_plugins, _config_plugins1;
|
|
297
|
+
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
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'));
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
340
302
|
]), {
|
|
341
303
|
bundler: 'webpack',
|
|
342
304
|
createCompiler,
|
|
@@ -377,13 +339,22 @@ let getMainFields = (chain, target)=>{
|
|
|
377
339
|
rsbuildOptions,
|
|
378
340
|
helpers
|
|
379
341
|
}, options),
|
|
380
|
-
inspectConfig
|
|
342
|
+
async inspectConfig (inspectOptions) {
|
|
343
|
+
let bundlerConfigs = (await initConfigs({
|
|
381
344
|
context,
|
|
382
345
|
pluginManager,
|
|
383
346
|
rsbuildOptions,
|
|
384
|
-
inspectOptions,
|
|
385
347
|
helpers
|
|
386
|
-
})
|
|
348
|
+
})).webpackConfigs;
|
|
349
|
+
return await helpers.inspectConfig({
|
|
350
|
+
context,
|
|
351
|
+
pluginManager,
|
|
352
|
+
bundler: 'webpack',
|
|
353
|
+
bundlerConfigs,
|
|
354
|
+
rsbuildOptions,
|
|
355
|
+
inspectOptions
|
|
356
|
+
});
|
|
357
|
+
}
|
|
387
358
|
};
|
|
388
359
|
};
|
|
389
360
|
export { webpackProvider };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"homepage": "https://rsbuild.
|
|
3
|
+
"version": "1.3.3",
|
|
4
|
+
"homepage": "https://rsbuild.rs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/web-infra-dev/rsbuild",
|
|
@@ -29,28 +29,28 @@
|
|
|
29
29
|
"picocolors": "^1.1.1",
|
|
30
30
|
"reduce-configs": "^1.1.0",
|
|
31
31
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
32
|
-
"webpack": "^5.
|
|
32
|
+
"webpack": "^5.101.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@rslib/core": "0.
|
|
36
|
-
"@types/node": "^22.
|
|
35
|
+
"@rslib/core": "0.11.1",
|
|
36
|
+
"@types/node": "^22.17.0",
|
|
37
37
|
"ansi-escapes": "4.3.2",
|
|
38
38
|
"cli-truncate": "2.1.0",
|
|
39
39
|
"patch-console": "1.0.0",
|
|
40
|
-
"typescript": "^5.
|
|
41
|
-
"@rsbuild/core": "1.
|
|
40
|
+
"typescript": "^5.9.2",
|
|
41
|
+
"@rsbuild/core": "1.4.14",
|
|
42
42
|
"@scripts/test-helper": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@rsbuild/core": "^1.
|
|
45
|
+
"@rsbuild/core": "^1.3.21"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public",
|
|
49
|
-
"provenance": true,
|
|
50
49
|
"registry": "https://registry.npmjs.org/"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
52
|
"build": "rslib build",
|
|
54
|
-
"dev": "rslib build --watch"
|
|
53
|
+
"dev": "rslib build --watch",
|
|
54
|
+
"bump": "npx bumpp --no-tag"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/dist/inspectConfig.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { InspectConfigOptions, InspectConfigResult } from '@rsbuild/core';
|
|
2
|
-
import { type InitConfigsOptions } from './initConfigs.js';
|
|
3
|
-
import type { WebpackConfig } from './types.js';
|
|
4
|
-
export declare function inspectConfig({ helpers, context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions, }: InitConfigsOptions & {
|
|
5
|
-
inspectOptions?: InspectConfigOptions;
|
|
6
|
-
bundlerConfigs?: WebpackConfig[];
|
|
7
|
-
}): Promise<InspectConfigResult<'webpack'>>;
|