@rsbuild/webpack 1.3.2 → 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 +70 -72
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -63
- package/dist/progress/helpers/index.d.ts +2 -2
- package/package.json +9 -9
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__ = {};
|
|
@@ -123,7 +123,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
123
123
|
})), core_.logger.debug('modify webpack config done'), modifiedConfig;
|
|
124
124
|
}
|
|
125
125
|
async function getChainUtils(target, environment, helpers) {
|
|
126
|
-
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"));
|
|
127
127
|
return {
|
|
128
128
|
...helpers.getChainUtils(target, environment),
|
|
129
129
|
name: ({
|
|
@@ -136,7 +136,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
async function generateWebpackConfig({ target, context, environment, helpers }) {
|
|
139
|
-
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, {
|
|
140
140
|
...chainUtils,
|
|
141
141
|
bundler: {
|
|
142
142
|
BannerPlugin,
|
|
@@ -188,17 +188,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
188
188
|
bundlerConfigs: webpackConfigs,
|
|
189
189
|
environments: context.environments
|
|
190
190
|
});
|
|
191
|
-
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?
|
|
192
|
-
|
|
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({
|
|
193
195
|
moduleTrace: !0,
|
|
194
196
|
children: !0,
|
|
195
197
|
preset: 'errors-warnings',
|
|
196
198
|
...statsOptions
|
|
197
|
-
}), { message, level } = helpers.formatStats(statsJson,
|
|
199
|
+
}), { message, level } = helpers.formatStats(statsJson, stats1.hasErrors());
|
|
198
200
|
'error' === level ? core_.logger.error(message) : 'warning' === level && core_.logger.warn(message);
|
|
199
|
-
};
|
|
200
|
-
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
201
|
-
done(stats);
|
|
202
201
|
}), 'dev' === context.action && helpers.registerDevHook({
|
|
203
202
|
compiler,
|
|
204
203
|
context,
|
|
@@ -259,61 +258,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
259
258
|
}
|
|
260
259
|
]);
|
|
261
260
|
}
|
|
262
|
-
let
|
|
263
|
-
let
|
|
264
|
-
return mainFields.length ? mainFields : !function(target) {
|
|
265
|
-
return castArray(target).includes('web') || target.includes('web-worker');
|
|
266
|
-
}(target) ? [
|
|
267
|
-
'module',
|
|
268
|
-
'main'
|
|
269
|
-
] : [
|
|
270
|
-
'browser',
|
|
271
|
-
'module',
|
|
272
|
-
'main'
|
|
273
|
-
];
|
|
274
|
-
}, pluginAdaptor = (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: getMainFields(chain, target),
|
|
284
|
-
extensions: chain.resolve.extensions.values()
|
|
285
|
-
});
|
|
286
|
-
let progress = config.dev.progressBar ?? !0;
|
|
287
|
-
if (progress) {
|
|
288
|
-
let { ProgressPlugin } = await Promise.all([
|
|
289
|
-
__webpack_require__.e("997"),
|
|
290
|
-
__webpack_require__.e("818")
|
|
291
|
-
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
292
|
-
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
293
|
-
{
|
|
294
|
-
id: environment.name,
|
|
295
|
-
prettyTime: helpers.prettyTime,
|
|
296
|
-
...!0 === progress ? {} : progress
|
|
297
|
-
}
|
|
298
|
-
]);
|
|
299
|
-
}
|
|
300
|
-
let { copy } = config.output;
|
|
301
|
-
if (copy) {
|
|
302
|
-
let { default: CopyPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "copy-webpack-plugin")), options = Array.isArray(copy) ? {
|
|
303
|
-
patterns: copy
|
|
304
|
-
} : copy;
|
|
305
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
306
|
-
options
|
|
307
|
-
]);
|
|
308
|
-
}
|
|
309
|
-
}), api.modifyWebpackConfig(async (config)=>{
|
|
310
|
-
var _config_plugins, _config_plugins1;
|
|
311
|
-
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
312
|
-
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'));
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}), webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
316
|
-
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"));
|
|
317
263
|
if (helpers.setCssExtractPlugin(cssExtractPlugin), helpers.setHTMLPlugin) {
|
|
318
264
|
let { default: htmlPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "html-webpack-plugin"));
|
|
319
265
|
helpers.setHTMLPlugin(htmlPlugin);
|
|
@@ -325,7 +271,59 @@ for(var __webpack_i__ in (()=>{
|
|
|
325
271
|
helpers
|
|
326
272
|
})).compiler;
|
|
327
273
|
return pluginManager.addPlugins([
|
|
328
|
-
|
|
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
|
+
})
|
|
329
327
|
]), {
|
|
330
328
|
bundler: 'webpack',
|
|
331
329
|
createCompiler,
|
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,9 +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
|
|
6
|
+
import MultiStats from "webpack/lib/MultiStats.js";
|
|
7
|
+
import { reduceConfigsWithContext } from "reduce-configs";
|
|
8
|
+
import node_fs from "node:fs";
|
|
9
9
|
var installedChunks, installChunk, __webpack_modules__ = {
|
|
10
10
|
"@rsbuild/core": function(module) {
|
|
11
11
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
@@ -93,7 +93,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
93
93
|
utils
|
|
94
94
|
]
|
|
95
95
|
});
|
|
96
|
-
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({
|
|
97
97
|
initial: modifiedConfig,
|
|
98
98
|
config: utils.environment.config.tools.webpack,
|
|
99
99
|
ctx: utils,
|
|
@@ -166,7 +166,8 @@ async function createCompiler_createCompiler(options) {
|
|
|
166
166
|
bundlerConfigs: webpackConfigs,
|
|
167
167
|
environments: context.environments
|
|
168
168
|
});
|
|
169
|
-
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)=>{
|
|
170
171
|
let statsOptions = helpers.getStatsOptions(compiler), statsJson = stats.toJson({
|
|
171
172
|
moduleTrace: !0,
|
|
172
173
|
children: !0,
|
|
@@ -174,14 +175,11 @@ async function createCompiler_createCompiler(options) {
|
|
|
174
175
|
...statsOptions
|
|
175
176
|
}), { message, level } = helpers.formatStats(statsJson, stats.hasErrors());
|
|
176
177
|
'error' === level ? core_.logger.error(message) : 'warning' === level && core_.logger.warn(message);
|
|
177
|
-
};
|
|
178
|
-
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
179
|
-
done(stats);
|
|
180
178
|
}), 'dev' === context.action && helpers.registerDevHook({
|
|
181
179
|
compiler,
|
|
182
180
|
context,
|
|
183
181
|
bundlerConfigs: webpackConfigs,
|
|
184
|
-
MultiStatsCtor:
|
|
182
|
+
MultiStatsCtor: MultiStats
|
|
185
183
|
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
186
184
|
compiler,
|
|
187
185
|
environments: context.environments
|
|
@@ -202,7 +200,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
202
200
|
bundlerConfigs: bundlerConfigs,
|
|
203
201
|
compiler,
|
|
204
202
|
isWatch: !!watch,
|
|
205
|
-
MultiStatsCtor:
|
|
203
|
+
MultiStatsCtor: MultiStats
|
|
206
204
|
}), watch) return compiler.watch({}, (err)=>{
|
|
207
205
|
err && core_.logger.error(err);
|
|
208
206
|
}), {
|
|
@@ -236,58 +234,7 @@ async function applyTsConfigPathsPlugin({ chain, CHAIN_ID, mainFields, extension
|
|
|
236
234
|
}
|
|
237
235
|
]);
|
|
238
236
|
}
|
|
239
|
-
let
|
|
240
|
-
let mainFields = chain.resolve.mainFields.values();
|
|
241
|
-
return mainFields.length ? mainFields : castArray(target).includes('web') || target.includes('web-worker') ? [
|
|
242
|
-
'browser',
|
|
243
|
-
'module',
|
|
244
|
-
'main'
|
|
245
|
-
] : [
|
|
246
|
-
'module',
|
|
247
|
-
'main'
|
|
248
|
-
];
|
|
249
|
-
}, pluginAdaptor = (helpers)=>({
|
|
250
|
-
name: 'rsbuild-webpack:adaptor',
|
|
251
|
-
setup (api) {
|
|
252
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
253
|
-
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
254
|
-
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
255
|
-
chain,
|
|
256
|
-
CHAIN_ID,
|
|
257
|
-
configFile: tsconfigPath,
|
|
258
|
-
mainFields: getMainFields(chain, target),
|
|
259
|
-
extensions: chain.resolve.extensions.values()
|
|
260
|
-
});
|
|
261
|
-
let progress = config.dev.progressBar ?? !0;
|
|
262
|
-
if (progress) {
|
|
263
|
-
let { ProgressPlugin } = await Promise.all([
|
|
264
|
-
__webpack_require__.e("997"),
|
|
265
|
-
__webpack_require__.e("812")
|
|
266
|
-
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
267
|
-
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
268
|
-
{
|
|
269
|
-
id: environment.name,
|
|
270
|
-
prettyTime: helpers.prettyTime,
|
|
271
|
-
...!0 === progress ? {} : progress
|
|
272
|
-
}
|
|
273
|
-
]);
|
|
274
|
-
}
|
|
275
|
-
let { copy } = config.output;
|
|
276
|
-
if (copy) {
|
|
277
|
-
let { default: CopyPlugin } = await import("copy-webpack-plugin"), options = Array.isArray(copy) ? {
|
|
278
|
-
patterns: copy
|
|
279
|
-
} : copy;
|
|
280
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
|
|
281
|
-
options
|
|
282
|
-
]);
|
|
283
|
-
}
|
|
284
|
-
}), api.modifyWebpackConfig(async (config)=>{
|
|
285
|
-
var _config_plugins, _config_plugins1;
|
|
286
|
-
let copyPlugin = null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.find((item)=>(null == item ? void 0 : item.constructor.name) === 'CopyPlugin');
|
|
287
|
-
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'));
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}), webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
237
|
+
let webpackProvider = async ({ context, pluginManager, rsbuildOptions, helpers })=>{
|
|
291
238
|
let { default: cssExtractPlugin } = await import("mini-css-extract-plugin");
|
|
292
239
|
if (helpers.setCssExtractPlugin(cssExtractPlugin), helpers.setHTMLPlugin) {
|
|
293
240
|
let { default: htmlPlugin } = await import("html-webpack-plugin");
|
|
@@ -300,7 +247,58 @@ let getMainFields = (chain, target)=>{
|
|
|
300
247
|
helpers
|
|
301
248
|
})).compiler;
|
|
302
249
|
return pluginManager.addPlugins([
|
|
303
|
-
|
|
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
|
+
}
|
|
304
302
|
]), {
|
|
305
303
|
bundler: 'webpack',
|
|
306
304
|
createCompiler,
|
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,16 +29,16 @@
|
|
|
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": {
|
|
@@ -46,11 +46,11 @@
|
|
|
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
|
}
|