@rsbuild/webpack 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/15.cjs CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  exports.ids = [
3
3
  '15'
4
- ];
5
- exports.modules = {
4
+ ], exports.modules = {
6
5
  "./src/progress/ProgressPlugin.ts": function(module, __webpack_exports__, __webpack_require__) {
7
6
  __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
8
7
  try {
@@ -11,75 +10,55 @@ exports.modules = {
11
10
  return ProgressPlugin;
12
11
  }
13
12
  });
14
- /* ESM import */ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core");
15
- /* ESM import */ var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors");
16
- /* ESM import */ var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
17
- /* ESM import */ var webpack__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("webpack");
18
- /* ESM import */ var _shared_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/shared.ts");
19
- /* ESM import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./src/progress/helpers/index.ts");
20
- /* ESM import */ var _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./src/progress/helpers/nonTty.ts");
21
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
13
+ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core"), picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors"), picocolors__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__), webpack__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("webpack"), _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/progress/helpers/index.ts"), _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./src/progress/helpers/nonTty.ts"), __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
22
14
  webpack__WEBPACK_IMPORTED_MODULE_2__
23
15
  ]);
24
- webpack__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
25
16
  function _define_property(obj, key, value) {
26
- if (key in obj) Object.defineProperty(obj, key, {
17
+ return key in obj ? Object.defineProperty(obj, key, {
27
18
  value: value,
28
- enumerable: true,
29
- configurable: true,
30
- writable: true
31
- });
32
- else obj[key] = value;
33
- return obj;
19
+ enumerable: !0,
20
+ configurable: !0,
21
+ writable: !0
22
+ }) : obj[key] = value, obj;
34
23
  }
35
- class ProgressPlugin extends webpack__WEBPACK_IMPORTED_MODULE_2__["default"].ProgressPlugin {
24
+ webpack__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
25
+ class ProgressPlugin extends webpack__WEBPACK_IMPORTED_MODULE_2__.default.ProgressPlugin {
36
26
  apply(compiler) {
37
27
  super.apply(compiler);
38
28
  let startTime = null;
39
29
  compiler.hooks.compile.tap(this.name, ()=>{
40
- this.compileTime = null;
41
- startTime = process.hrtime();
42
- });
43
- compiler.hooks.done.tap(this.name, (stat)=>{
30
+ this.compileTime = null, startTime = process.hrtime();
31
+ }), compiler.hooks.done.tap(this.name, (stat)=>{
44
32
  if (startTime) {
45
33
  this.hasCompileErrors = stat.hasErrors();
46
- const hrtime = process.hrtime(startTime);
47
- const seconds = hrtime[0] + hrtime[1] / 1e9;
48
- this.compileTime = (0, _shared_js__WEBPACK_IMPORTED_MODULE_3__ /* .prettyTime */ .AS)(seconds);
49
- startTime = null;
50
- if (!this.hasCompileErrors) {
51
- const suffix = this.id ? picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(` (${this.id})`) : '';
34
+ let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
35
+ if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
36
+ let suffix = this.id ? picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(` (${this.id})`) : '';
52
37
  _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.ready(`Built in ${this.compileTime} ${suffix}`);
53
38
  }
54
39
  }
55
40
  });
56
41
  }
57
42
  constructor(options){
58
- const { id = 'Rsbuild' } = options;
59
- const nonTTYLogger = (0, _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_5__ /* .createNonTTYLogger */ .y)();
60
- const friendlyPercentage = (0, _helpers_index_js__WEBPACK_IMPORTED_MODULE_4__ /* .createFriendlyPercentage */ .$b)();
43
+ let { id = 'Rsbuild' } = options, nonTTYLogger = (0, _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_4__.y)(), friendlyPercentage = (0, _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$b)();
61
44
  super({
62
- activeModules: false,
63
- entries: true,
64
- modules: true,
45
+ activeModules: !1,
46
+ entries: !0,
47
+ modules: !0,
65
48
  modulesCount: 5000,
66
- profile: false,
67
- dependencies: true,
49
+ profile: !1,
50
+ dependencies: !0,
68
51
  dependenciesCount: 10000,
69
52
  percentBy: null,
70
53
  handler: (originalPercentage, message)=>{
71
- const percentage = friendlyPercentage(originalPercentage);
72
- const done = 1 === percentage;
73
- if (process.stdout.isTTY) {
74
- _helpers_index_js__WEBPACK_IMPORTED_MODULE_4__ /* .bus.update */ .$x.update({
75
- id,
76
- current: 100 * percentage,
77
- message,
78
- done,
79
- hasErrors: this.hasCompileErrors
80
- });
81
- _helpers_index_js__WEBPACK_IMPORTED_MODULE_4__ /* .bus.render */ .$x.render();
82
- } else nonTTYLogger.log({
54
+ let percentage = friendlyPercentage(originalPercentage), done = 1 === percentage;
55
+ process.stdout.isTTY ? (_helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$x.update({
56
+ id,
57
+ current: 100 * percentage,
58
+ message,
59
+ done,
60
+ hasErrors: this.hasCompileErrors
61
+ }), _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$x.render()) : nonTTYLogger.log({
83
62
  id,
84
63
  done,
85
64
  current: 100 * percentage,
@@ -87,8 +66,7 @@ exports.modules = {
87
66
  compileTime: this.compileTime
88
67
  });
89
68
  }
90
- }), _define_property(this, "name", 'ProgressPlugin'), _define_property(this, "id", void 0), _define_property(this, "hasCompileErrors", false), _define_property(this, "compileTime", null);
91
- this.id = id;
69
+ }), _define_property(this, "name", 'ProgressPlugin'), _define_property(this, "id", void 0), _define_property(this, "hasCompileErrors", !1), _define_property(this, "compileTime", null), _define_property(this, "prettyTime", void 0), this.id = id, this.prettyTime = options.prettyTime;
92
70
  }
93
71
  }
94
72
  __webpack_async_result__();
@@ -98,25 +76,12 @@ exports.modules = {
98
76
  });
99
77
  },
100
78
  "./src/progress/helpers/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
101
- // EXPORTS
102
79
  __webpack_require__.d(__webpack_exports__, {
103
- $x: ()=>/* reexport */ bus,
104
- $b: ()=>/* reexport */ createFriendlyPercentage
80
+ $x: ()=>bus,
81
+ $b: ()=>createFriendlyPercentage
105
82
  });
106
- // UNUSED EXPORTS: FULL_WIDTH, renderBar, MIDDLE_WIDTH, SMALL_WIDTH, getProgressColor
107
- // EXTERNAL MODULE: external "node:console"
108
- var external_node_console_ = __webpack_require__("node:console");
109
- // EXTERNAL MODULE: ../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js
110
- var cli_truncate = __webpack_require__("../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js");
111
- var cli_truncate_default = /*#__PURE__*/ __webpack_require__.n(cli_truncate);
112
- // EXTERNAL MODULE: ../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js
113
- var build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js");
114
- var build_default = /*#__PURE__*/ __webpack_require__.n(build);
115
- // EXTERNAL MODULE: external "picocolors"
116
- var external_picocolors_ = __webpack_require__("picocolors");
117
- var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_);
118
- const clamp = (x, min, max)=>Math.min(max, Math.max(min, x));
119
- const defaultOption = {
83
+ var external_node_console_ = __webpack_require__("node:console"), 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), build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"), build_default = __webpack_require__.n(build), external_picocolors_ = __webpack_require__("picocolors"), external_picocolors_default = __webpack_require__.n(external_picocolors_);
84
+ let clamp = (x, min, max)=>Math.min(max, Math.max(min, x)), defaultOption = {
120
85
  total: 100,
121
86
  current: 0,
122
87
  color: 'green',
@@ -127,61 +92,39 @@ exports.modules = {
127
92
  errorIcon: '✖',
128
93
  errorInfo: 'compile failed',
129
94
  message: '',
130
- done: false,
95
+ done: !1,
131
96
  spaceWidth: 1,
132
97
  messageWidth: 25,
133
98
  messageColor: 'gray',
134
99
  id: '',
135
100
  maxIdLen: 16,
136
- hasErrors: false
137
- };
138
- const padding = (id, maxLen)=>{
139
- const left = Math.floor((maxLen - id.length) / 2);
140
- const right = maxLen - left - id.length;
101
+ hasErrors: !1
102
+ }, padding = (id, maxLen)=>{
103
+ let left = Math.floor((maxLen - id.length) / 2), right = maxLen - left - id.length;
141
104
  return ' '.repeat(left) + id + ' '.repeat(right);
142
- };
143
- const FULL_WIDTH = 70; // display all info
144
- const MIDDLE_WIDTH = 40; // remove message info
145
- const renderBar = (option)=>{
146
- const mergedOptions = {
105
+ }, renderBar = (option)=>{
106
+ let mergedOptions = {
147
107
  ...defaultOption,
148
108
  ...option
149
- };
150
- const { total, done, buildIcon, errorIcon, errorInfo, width, current, color, bgColor, char, message, messageWidth, spaceWidth, messageColor, maxIdLen, hasErrors } = mergedOptions;
151
- const space = ' '.repeat(spaceWidth);
152
- const percent = clamp(Math.floor(current / total * 100), 0, 100);
153
- // @ts-expect-error
154
- const barColor = external_picocolors_default()[color];
155
- // @ts-expect-error
156
- const backgroundColor = external_picocolors_default()[bgColor];
157
- const doneColor = hasErrors ? external_picocolors_default().red : barColor;
158
- const idColor = done ? doneColor : barColor;
159
- const id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : '';
160
- const { columns: terminalWidth = FULL_WIDTH } = process.stdout;
109
+ }, { 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;
161
110
  if (done) {
162
111
  if (hasErrors) {
163
- const message = external_picocolors_default().bold(doneColor(errorInfo));
164
- if (terminalWidth >= MIDDLE_WIDTH) return [
112
+ let message = external_picocolors_default().bold(doneColor(errorInfo));
113
+ return terminalWidth >= 40 ? [
165
114
  idColor(errorIcon),
166
115
  id,
167
116
  doneColor(`${space}${message}`)
168
- ].join('');
169
- return [
117
+ ].join('') : [
170
118
  id,
171
119
  doneColor(`${message}`)
172
120
  ].join('');
173
121
  }
174
122
  return '';
175
123
  }
176
- // @ts-expect-error
177
- const msgStr = external_picocolors_default()[messageColor](cli_truncate_default()(message, messageWidth, {
124
+ let msgStr = external_picocolors_default()[messageColor](cli_truncate_default()(message, messageWidth, {
178
125
  position: 'start'
179
- }));
180
- const left = clamp(Math.floor(percent * width / 100), 0, width);
181
- const right = clamp(width - left, 0, width);
182
- const barStr = `${barColor(char.repeat(left))}${backgroundColor(char.repeat(right))}`;
183
- const percentStr = `${percent.toString().padStart(3)}%`;
184
- if (terminalWidth >= FULL_WIDTH) return [
126
+ })), 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)}%`;
127
+ return terminalWidth >= 70 ? [
185
128
  idColor(buildIcon),
186
129
  id,
187
130
  space,
@@ -190,67 +133,49 @@ exports.modules = {
190
133
  percentStr,
191
134
  space,
192
135
  msgStr
193
- ].join('');
194
- if (terminalWidth >= MIDDLE_WIDTH) return [
136
+ ].join('') : terminalWidth >= 40 ? [
195
137
  idColor(buildIcon),
196
138
  id,
197
139
  space,
198
140
  barStr,
199
141
  space,
200
142
  percentStr
201
- ].join('');
202
- return [
143
+ ].join('') : [
203
144
  idColor(buildIcon),
204
145
  id,
205
146
  space,
206
147
  percentStr
207
148
  ].join('');
208
149
  };
209
- // EXTERNAL MODULE: ../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js
210
- var ansi_escapes = __webpack_require__("../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js");
211
- var ansi_escapes_default = /*#__PURE__*/ __webpack_require__.n(ansi_escapes);
212
- const create = (stream)=>{
213
- let previousLineCount = 0;
214
- let previousOutput = '';
215
- const render = (str)=>{
216
- const output = `${str}\n`;
217
- if (output === previousOutput) return;
218
- previousOutput = output;
219
- stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output);
220
- previousLineCount = output.split('\n').length;
221
- };
222
- render.clear = ()=>{
223
- stream.write(ansi_escapes_default().eraseLines(previousLineCount));
224
- previousOutput = '';
225
- previousLineCount = 0;
150
+ 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);
151
+ let create = (stream)=>{
152
+ let previousLineCount = 0, previousOutput = '', render = (str)=>{
153
+ let output = `${str}\n`;
154
+ if (output !== previousOutput) previousOutput = output, stream.write(ansi_escapes_default().eraseLines(previousLineCount) + output), previousLineCount = output.split('\n').length;
226
155
  };
227
- render.done = ()=>{
228
- previousOutput = '';
229
- previousLineCount = 0;
230
- };
231
- return render;
156
+ return render.clear = ()=>{
157
+ stream.write(ansi_escapes_default().eraseLines(previousLineCount)), previousOutput = '', previousLineCount = 0;
158
+ }, render.done = ()=>{
159
+ previousOutput = '', previousLineCount = 0;
160
+ }, render;
232
161
  };
233
162
  function _define_property(obj, key, value) {
234
- if (key in obj) Object.defineProperty(obj, key, {
163
+ return key in obj ? Object.defineProperty(obj, key, {
235
164
  value: value,
236
- enumerable: true,
237
- configurable: true,
238
- writable: true
239
- });
240
- else obj[key] = value;
241
- return obj;
165
+ enumerable: !0,
166
+ configurable: !0,
167
+ writable: !0
168
+ }) : obj[key] = value, obj;
242
169
  }
243
- const colorList = [
170
+ let colorList = [
244
171
  'green',
245
172
  'cyan',
246
173
  'yellow',
247
174
  'blue',
248
175
  'magenta'
249
- ];
250
- const getProgressColor = (index)=>colorList[index % colorList.length];
251
- class Bus {
176
+ ], getProgressColor = (index)=>colorList[index % colorList.length], bus = new class Bus {
252
177
  update(state) {
253
- const index = this.states.findIndex((i)=>i.id === state.id);
178
+ let index = this.states.findIndex((i)=>i.id === state.id);
254
179
  if (-1 === index) {
255
180
  this.states.push(state);
256
181
  return;
@@ -258,78 +183,44 @@ exports.modules = {
258
183
  this.states[index] = state;
259
184
  }
260
185
  writeToStd(type = 'stdout', data) {
261
- this.log.clear();
262
- if (data) {
263
- if ('stdout' === type) process.stdout.write(data);
264
- else if ('stderr' === type) process.stderr.write(data);
265
- }
266
- this.log(this.prevOutput);
186
+ this.log.clear(), data && ('stdout' === type ? process.stdout.write(data) : 'stderr' === type && process.stderr.write(data)), this.log(this.prevOutput);
267
187
  }
268
188
  render() {
269
- const maxIdLen = Math.max(...this.states.map((i)=>{
189
+ let maxIdLen = Math.max(...this.states.map((i)=>{
270
190
  var _i_id;
271
191
  return (null === (_i_id = i.id) || void 0 === _i_id ? void 0 : _i_id.length) ?? 0;
272
- })) + 2;
273
- const { columns = FULL_WIDTH } = process.stdout;
192
+ })) + 2, { columns = 70 } = process.stdout;
274
193
  this.prevOutput = this.states.map((i, k)=>{
275
- const bar = renderBar({
194
+ let bar = renderBar({
276
195
  maxIdLen,
277
196
  color: i.color ?? getProgressColor(k),
278
197
  ...i
279
198
  });
280
- if (bar) return cli_truncate_default()(bar, columns, {
199
+ return bar ? cli_truncate_default()(bar, columns, {
281
200
  position: 'end'
282
- });
283
- return null;
284
- }).filter((item)=>null !== item).join('\n');
285
- this.writeToStd();
201
+ }) : null;
202
+ }).filter((item)=>null !== item).join('\n'), this.writeToStd();
286
203
  }
287
204
  destroy() {
288
- if (!this.destroyed) this.restore();
289
- this.destroyed = true;
205
+ !this.destroyed && this.restore(), this.destroyed = !0;
290
206
  }
291
207
  clear() {
292
- this.log.clear();
293
- this.log.done();
208
+ this.log.clear(), this.log.done();
294
209
  }
295
210
  constructor(){
296
- _define_property(this, "states", []);
297
- _define_property(this, "log", void 0);
298
- _define_property(this, "restore", void 0);
299
- _define_property(this, "prevOutput", void 0);
300
- _define_property(this, "destroyed", false);
301
- this.prevOutput = '';
302
- this.log = create(process.stdout);
303
- console.Console = external_node_console_.Console;
304
- this.restore = build_default()((type, data)=>{
211
+ _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 = create(process.stdout), console.Console = external_node_console_.Console, this.restore = build_default()((type, data)=>{
305
212
  this.writeToStd(type, data);
306
213
  });
307
214
  }
308
- }
309
- const bus = new Bus();
310
- /**
311
- * Make the progress percentage more user friendly.
312
- * The original percentage may pause at certain number for a long time,
313
- * or decrease in some cases, which will confuse the user.
314
- * So we format the percentage number and display a more smooth percentage.
315
- */ const createFriendlyPercentage = ()=>{
215
+ }(), createFriendlyPercentage = ()=>{
316
216
  let prevPercentage = 0;
317
217
  return (percentage)=>{
318
- if (0 === percentage || 1 === percentage) {
319
- prevPercentage = 0;
320
- return percentage;
321
- }
218
+ if (0 === percentage || 1 === percentage) return prevPercentage = 0, percentage;
322
219
  if (percentage <= prevPercentage) {
323
220
  let step = 0;
324
- if (prevPercentage < 0.3) step = 0.001;
325
- else if (prevPercentage < 0.6) step = 0.002;
326
- else if (prevPercentage < 0.8) step = 0.004;
327
- else if (prevPercentage < 0.99) step = 0.002;
328
- prevPercentage += step;
329
- return prevPercentage;
221
+ 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;
330
222
  }
331
- prevPercentage = percentage;
332
- return percentage;
223
+ return prevPercentage = percentage, percentage;
333
224
  };
334
225
  };
335
226
  },
@@ -339,26 +230,17 @@ exports.modules = {
339
230
  return createNonTTYLogger;
340
231
  }
341
232
  });
342
- /* ESM import */ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core");
343
- /* ESM import */ var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors");
344
- /* ESM import */ var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
233
+ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core"), picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors"), picocolors__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
345
234
  function createNonTTYLogger() {
346
235
  let prevPercentage = 0;
347
- const log = ({ id, done, current, hasErrors, compileTime })=>{
348
- const suffix = picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(`(${id})`);
349
- if (done) {
350
- // avoid printing done twice
351
- if (100 === prevPercentage) return;
352
- prevPercentage = 100;
353
- if (hasErrors) _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Built failed in ${compileTime} ${suffix}`);
354
- else _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.ready(`Built in ${compileTime} ${suffix}`);
355
- } else if (current - prevPercentage > 10) {
356
- prevPercentage = current;
357
- _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.info(`Build progress: ${current.toFixed(0)}% ${suffix}`);
358
- }
359
- };
360
236
  return {
361
- log
237
+ log: ({ id, done, current, hasErrors, compileTime })=>{
238
+ let suffix = picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(`(${id})`);
239
+ if (done) {
240
+ if (100 === prevPercentage) return;
241
+ prevPercentage = 100, hasErrors ? _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Built failed in ${compileTime} ${suffix}`) : _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.ready(`Built in ${compileTime} ${suffix}`);
242
+ } else current - prevPercentage > 10 && (prevPercentage = current, _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.info(`Build progress: ${current.toFixed(0)}% ${suffix}`));
243
+ }
362
244
  };
363
245
  }
364
246
  }