@rsbuild/core 1.6.10 → 1.6.11

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/131.js CHANGED
@@ -17,34 +17,6 @@ import { isPromise, isRegExp } from "node:util/types";
17
17
  import { promisify as external_node_util_promisify } from "node:util";
18
18
  import node_zlib from "node:zlib";
19
19
  __webpack_require__.add({
20
- "../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
21
- let clone = __webpack_require__("../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js"), typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"), isPlainObject = __webpack_require__("../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js");
22
- function cloneDeep(val, instanceClone) {
23
- switch(typeOf(val)){
24
- case 'object':
25
- return cloneObjectDeep(val, instanceClone);
26
- case 'array':
27
- return cloneArrayDeep(val, instanceClone);
28
- default:
29
- return clone(val);
30
- }
31
- }
32
- function cloneObjectDeep(val, instanceClone) {
33
- if ('function' == typeof instanceClone) return instanceClone(val);
34
- if (instanceClone || isPlainObject(val)) {
35
- let res = new val.constructor();
36
- for(let key in val)res[key] = cloneDeep(val[key], instanceClone);
37
- return res;
38
- }
39
- return val;
40
- }
41
- function cloneArrayDeep(val, instanceClone) {
42
- let res = new val.constructor(val.length);
43
- for(let i = 0; i < val.length; i++)res[i] = cloneDeep(val[i], instanceClone);
44
- return res;
45
- }
46
- module.exports = cloneDeep;
47
- },
48
20
  "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
49
21
  var isMergeableObject = function isMergeableObject(value) {
50
22
  return isNonNullObject(value) && !isSpecial(value);
@@ -179,71 +151,6 @@ __webpack_require__.add({
179
151
  return thunk.cancel = cleanup, thunk;
180
152
  };
181
153
  },
182
- "../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js": function(module) {
183
- function isBuffer(obj) {
184
- return obj && obj.constructor && 'function' == typeof obj.constructor.isBuffer && obj.constructor.isBuffer(obj);
185
- }
186
- function keyIdentity(key) {
187
- return key;
188
- }
189
- function flatten(target, opts) {
190
- let delimiter = (opts = opts || {}).delimiter || '.', maxDepth = opts.maxDepth, transformKey = opts.transformKey || keyIdentity, output = {};
191
- function step(object, prev, currentDepth) {
192
- currentDepth = currentDepth || 1, Object.keys(object).forEach(function(key) {
193
- let value = object[key], isarray = opts.safe && Array.isArray(value), type = Object.prototype.toString.call(value), isbuffer = isBuffer(value), newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
194
- if (!isarray && !isbuffer && ('[object Object]' === type || '[object Array]' === type) && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
195
- output[newKey] = value;
196
- });
197
- }
198
- return step(target), output;
199
- }
200
- function unflatten(target, opts) {
201
- let delimiter = (opts = opts || {}).delimiter || '.', overwrite = opts.overwrite || !1, transformKey = opts.transformKey || keyIdentity, result = {};
202
- if (isBuffer(target) || '[object Object]' !== Object.prototype.toString.call(target)) return target;
203
- function getkey(key) {
204
- let parsedKey = Number(key);
205
- return isNaN(parsedKey) || -1 !== key.indexOf('.') || opts.object ? key : parsedKey;
206
- }
207
- function addKeys(keyPrefix, recipient, target) {
208
- return Object.keys(target).reduce(function(result, key) {
209
- return result[keyPrefix + delimiter + key] = target[key], result;
210
- }, recipient);
211
- }
212
- function isEmpty(val) {
213
- let type = Object.prototype.toString.call(val);
214
- return !val || ('[object Array]' === type ? !val.length : '[object Object]' === type ? !Object.keys(val).length : void 0);
215
- }
216
- return Object.keys(target = Object.keys(target).reduce(function(result, key) {
217
- let type = Object.prototype.toString.call(target[key]);
218
- return '[object Object]' !== type && '[object Array]' !== type || isEmpty(target[key]) ? (result[key] = target[key], result) : addKeys(key, result, flatten(target[key], opts));
219
- }, {})).forEach(function(key) {
220
- let split = key.split(delimiter).map(transformKey), key1 = getkey(split.shift()), key2 = getkey(split[0]), recipient = result;
221
- for(; void 0 !== key2;){
222
- if ('__proto__' === key1) return;
223
- let type = Object.prototype.toString.call(recipient[key1]), isobject = '[object Object]' === type || '[object Array]' === type;
224
- if (!overwrite && !isobject && void 0 !== recipient[key1]) return;
225
- (!overwrite || isobject) && (overwrite || null != recipient[key1]) || (recipient[key1] = 'number' != typeof key2 || opts.object ? {} : []), recipient = recipient[key1], split.length > 0 && (key1 = getkey(split.shift()), key2 = getkey(split[0]));
226
- }
227
- recipient[key1] = unflatten(target[key], opts);
228
- }), result;
229
- }
230
- module.exports = flatten, flatten.flatten = flatten, flatten.unflatten = unflatten;
231
- },
232
- "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
233
- var isObject = __webpack_require__("../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js");
234
- function isObjectObject(o) {
235
- return !0 === isObject(o) && '[object Object]' === Object.prototype.toString.call(o);
236
- }
237
- module.exports = function isPlainObject(o) {
238
- var ctor, prot;
239
- return !1 !== isObjectObject(o) && 'function' == typeof (ctor = o.constructor) && !1 !== isObjectObject(prot = ctor.prototype) && !1 !== prot.hasOwnProperty('isPrototypeOf');
240
- };
241
- },
242
- "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js": function(module) {
243
- module.exports = function isObject(val) {
244
- return null != val && 'object' == typeof val && !1 === Array.isArray(val);
245
- };
246
- },
247
154
  "../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js": function(__unused_webpack_module, exports) {
248
155
  Object.defineProperty(exports, "__esModule", {
249
156
  value: !0
@@ -538,103 +445,6 @@ __webpack_require__.add({
538
445
  };
539
446
  exports.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
540
447
  },
541
- "../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js": function(module) {
542
- var toString = Object.prototype.toString;
543
- function ctorName(val) {
544
- return 'function' == typeof val.constructor ? val.constructor.name : null;
545
- }
546
- function isArray(val) {
547
- return Array.isArray ? Array.isArray(val) : val instanceof Array;
548
- }
549
- function isError(val) {
550
- return val instanceof Error || 'string' == typeof val.message && val.constructor && 'number' == typeof val.constructor.stackTraceLimit;
551
- }
552
- function isDate(val) {
553
- return val instanceof Date || 'function' == typeof val.toDateString && 'function' == typeof val.getDate && 'function' == typeof val.setDate;
554
- }
555
- function isRegexp(val) {
556
- return val instanceof RegExp || 'string' == typeof val.flags && 'boolean' == typeof val.ignoreCase && 'boolean' == typeof val.multiline && 'boolean' == typeof val.global;
557
- }
558
- function isGeneratorFn(name, val) {
559
- return 'GeneratorFunction' === ctorName(name);
560
- }
561
- function isGeneratorObj(val) {
562
- return 'function' == typeof val.throw && 'function' == typeof val.return && 'function' == typeof val.next;
563
- }
564
- function isArguments(val) {
565
- try {
566
- if ('number' == typeof val.length && 'function' == typeof val.callee) return !0;
567
- } catch (err) {
568
- if (-1 !== err.message.indexOf('callee')) return !0;
569
- }
570
- return !1;
571
- }
572
- function isBuffer(val) {
573
- return !!val.constructor && 'function' == typeof val.constructor.isBuffer && val.constructor.isBuffer(val);
574
- }
575
- module.exports = function kindOf(val) {
576
- if (void 0 === val) return 'undefined';
577
- if (null === val) return 'null';
578
- var type = typeof val;
579
- if ('boolean' === type) return 'boolean';
580
- if ('string' === type) return 'string';
581
- if ('number' === type) return 'number';
582
- if ('symbol' === type) return 'symbol';
583
- if ('function' === type) return isGeneratorFn(val) ? 'generatorfunction' : 'function';
584
- if (isArray(val)) return 'array';
585
- if (isBuffer(val)) return 'buffer';
586
- if (isArguments(val)) return 'arguments';
587
- if (isDate(val)) return 'date';
588
- if (isError(val)) return 'error';
589
- if (isRegexp(val)) return 'regexp';
590
- switch(ctorName(val)){
591
- case 'Symbol':
592
- return 'symbol';
593
- case 'Promise':
594
- return 'promise';
595
- case 'WeakMap':
596
- return 'weakmap';
597
- case 'WeakSet':
598
- return 'weakset';
599
- case 'Map':
600
- return 'map';
601
- case 'Set':
602
- return 'set';
603
- case 'Int8Array':
604
- return 'int8array';
605
- case 'Uint8Array':
606
- return 'uint8array';
607
- case 'Uint8ClampedArray':
608
- return 'uint8clampedarray';
609
- case 'Int16Array':
610
- return 'int16array';
611
- case 'Uint16Array':
612
- return 'uint16array';
613
- case 'Int32Array':
614
- return 'int32array';
615
- case 'Uint32Array':
616
- return 'uint32array';
617
- case 'Float32Array':
618
- return 'float32array';
619
- case 'Float64Array':
620
- return 'float64array';
621
- }
622
- if (isGeneratorObj(val)) return 'generator';
623
- switch(type = toString.call(val)){
624
- case '[object Object]':
625
- return 'object';
626
- case '[object Map Iterator]':
627
- return 'mapiterator';
628
- case '[object Set Iterator]':
629
- return 'setiterator';
630
- case '[object String Iterator]':
631
- return 'stringiterator';
632
- case '[object Array Iterator]':
633
- return 'arrayiterator';
634
- }
635
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
636
- };
637
- },
638
448
  "../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
639
449
  let path = __webpack_require__("path"), fs = __webpack_require__("fs"), os = __webpack_require__("os"), url = __webpack_require__("url"), fsReadFileAsync = fs.promises.readFile;
640
450
  function getDefaultSearchPlaces(name, sync) {
@@ -1099,494 +909,6 @@ __webpack_require__.add({
1099
909
  throw Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.map((error)=>error.message).join('\n')}`);
1100
910
  };
1101
911
  },
1102
- "../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
1103
- let valueOf = Symbol.prototype.valueOf, typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js");
1104
- function cloneRegExp(val) {
1105
- let flags = void 0 !== val.flags ? val.flags : /\w+$/.exec(val) || void 0, re = new val.constructor(val.source, flags);
1106
- return re.lastIndex = val.lastIndex, re;
1107
- }
1108
- function cloneArrayBuffer(val) {
1109
- let res = new val.constructor(val.byteLength);
1110
- return new Uint8Array(res).set(new Uint8Array(val)), res;
1111
- }
1112
- function cloneTypedArray(val, deep) {
1113
- return new val.constructor(val.buffer, val.byteOffset, val.length);
1114
- }
1115
- function cloneBuffer(val) {
1116
- let len = val.length, buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
1117
- return val.copy(buf), buf;
1118
- }
1119
- function cloneSymbol(val) {
1120
- return valueOf ? Object(valueOf.call(val)) : {};
1121
- }
1122
- module.exports = function clone(val, deep) {
1123
- switch(typeOf(val)){
1124
- case 'array':
1125
- return val.slice();
1126
- case 'object':
1127
- return Object.assign({}, val);
1128
- case 'date':
1129
- return new val.constructor(Number(val));
1130
- case 'map':
1131
- return new Map(val);
1132
- case 'set':
1133
- return new Set(val);
1134
- case 'buffer':
1135
- return cloneBuffer(val);
1136
- case 'symbol':
1137
- return cloneSymbol(val);
1138
- case 'arraybuffer':
1139
- return cloneArrayBuffer(val);
1140
- case 'float32array':
1141
- case 'float64array':
1142
- case 'int16array':
1143
- case 'int32array':
1144
- case 'int8array':
1145
- case 'uint16array':
1146
- case 'uint32array':
1147
- case 'uint8clampedarray':
1148
- case 'uint8array':
1149
- return cloneTypedArray(val);
1150
- case 'regexp':
1151
- return cloneRegExp(val);
1152
- case 'error':
1153
- return Object.create(val);
1154
- default:
1155
- return val;
1156
- }
1157
- };
1158
- },
1159
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
1160
- var __read = this && this.__read || function(o, n) {
1161
- var m = "function" == typeof Symbol && o[Symbol.iterator];
1162
- if (!m) return o;
1163
- var r, e, i = m.call(o), ar = [];
1164
- try {
1165
- for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1166
- } catch (error) {
1167
- e = {
1168
- error: error
1169
- };
1170
- } finally{
1171
- try {
1172
- r && !r.done && (m = i.return) && m.call(i);
1173
- } finally{
1174
- if (e) throw e.error;
1175
- }
1176
- }
1177
- return ar;
1178
- }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
1179
- if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
1180
- return to.concat(ar || Array.prototype.slice.call(from));
1181
- }, __importDefault = this && this.__importDefault || function(mod) {
1182
- return mod && mod.__esModule ? mod : {
1183
- default: mod
1184
- };
1185
- };
1186
- Object.defineProperty(exports, "__esModule", {
1187
- value: !0
1188
- }), exports.unique = exports.mergeWithRules = exports.mergeWithCustomize = exports.default = exports.merge = exports.CustomizeRule = exports.customizeObject = exports.customizeArray = void 0;
1189
- var wildcard_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js")), merge_with_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js")), join_arrays_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js"));
1190
- exports.unique = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js")).default;
1191
- var types_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js");
1192
- Object.defineProperty(exports, "CustomizeRule", {
1193
- enumerable: !0,
1194
- get: function() {
1195
- return types_1.CustomizeRule;
1196
- }
1197
- });
1198
- var utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js");
1199
- function merge(firstConfiguration) {
1200
- for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
1201
- return mergeWithCustomize({}).apply(void 0, __spreadArray([
1202
- firstConfiguration
1203
- ], __read(configurations), !1));
1204
- }
1205
- function mergeWithCustomize(options) {
1206
- return function mergeWithOptions(firstConfiguration) {
1207
- for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
1208
- if ((0, utils_1.isUndefined)(firstConfiguration) || configurations.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
1209
- if (firstConfiguration.then) throw TypeError("Promises are not supported");
1210
- if (!firstConfiguration) return {};
1211
- if (0 === configurations.length) {
1212
- if (Array.isArray(firstConfiguration)) {
1213
- if (0 === firstConfiguration.length) return {};
1214
- if (firstConfiguration.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
1215
- if (firstConfiguration[0].then) throw TypeError("Promises are not supported");
1216
- return (0, merge_with_1.default)(firstConfiguration, (0, join_arrays_1.default)(options));
1217
- }
1218
- return firstConfiguration;
1219
- }
1220
- return (0, merge_with_1.default)([
1221
- firstConfiguration
1222
- ].concat(configurations), (0, join_arrays_1.default)(options));
1223
- };
1224
- }
1225
- exports.merge = merge, exports.default = merge, exports.mergeWithCustomize = mergeWithCustomize, exports.customizeArray = function customizeArray(rules) {
1226
- return function(a, b, key) {
1227
- var matchedRule = Object.keys(rules).find(function(rule) {
1228
- return (0, wildcard_1.default)(rule, key);
1229
- }) || "";
1230
- if (matchedRule) switch(rules[matchedRule]){
1231
- case types_1.CustomizeRule.Prepend:
1232
- return __spreadArray(__spreadArray([], __read(b), !1), __read(a), !1);
1233
- case types_1.CustomizeRule.Replace:
1234
- return b;
1235
- case types_1.CustomizeRule.Append:
1236
- default:
1237
- return __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
1238
- }
1239
- };
1240
- }, exports.mergeWithRules = function mergeWithRules(rules) {
1241
- return mergeWithCustomize({
1242
- customizeArray: function(a, b, key) {
1243
- var currentRule = rules;
1244
- return (key.split(".").forEach(function(k) {
1245
- currentRule && (currentRule = currentRule[k]);
1246
- }), (0, utils_1.isPlainObject)(currentRule)) ? mergeWithRule({
1247
- currentRule: currentRule,
1248
- a: a,
1249
- b: b
1250
- }) : "string" == typeof currentRule ? mergeIndividualRule({
1251
- currentRule: currentRule,
1252
- a: a,
1253
- b: b
1254
- }) : void 0;
1255
- }
1256
- });
1257
- };
1258
- var isArray = Array.isArray;
1259
- function mergeWithRule(_a) {
1260
- var currentRule = _a.currentRule, a = _a.a, b = _a.b;
1261
- if (!isArray(a)) return a;
1262
- var bAllMatches = [];
1263
- return a.map(function(ao) {
1264
- if (!(0, utils_1.isPlainObject)(currentRule)) return ao;
1265
- var ret = {}, rulesToMatch = [], operations = {};
1266
- Object.entries(currentRule).forEach(function(_a) {
1267
- var _b = __read(_a, 2), k = _b[0], v = _b[1];
1268
- v === types_1.CustomizeRule.Match ? rulesToMatch.push(k) : operations[k] = v;
1269
- });
1270
- var bMatches = b.filter(function(o) {
1271
- var matches = rulesToMatch.every(function(rule) {
1272
- return (0, utils_1.isSameCondition)(ao[rule], o[rule]);
1273
- });
1274
- return matches && bAllMatches.push(o), matches;
1275
- });
1276
- return (0, utils_1.isPlainObject)(ao) ? (Object.entries(ao).forEach(function(_a) {
1277
- var _b = __read(_a, 2), k = _b[0], v = _b[1];
1278
- switch(currentRule[k]){
1279
- case types_1.CustomizeRule.Match:
1280
- ret[k] = v, Object.entries(currentRule).forEach(function(_a) {
1281
- var _b = __read(_a, 2), k = _b[0];
1282
- if (_b[1] === types_1.CustomizeRule.Replace && bMatches.length > 0) {
1283
- var val = last(bMatches)[k];
1284
- void 0 !== val && (ret[k] = val);
1285
- }
1286
- });
1287
- break;
1288
- case types_1.CustomizeRule.Append:
1289
- if (!bMatches.length) {
1290
- ret[k] = v;
1291
- break;
1292
- }
1293
- var appendValue = last(bMatches)[k];
1294
- if (!isArray(v) || !isArray(appendValue)) throw TypeError("Trying to append non-arrays");
1295
- ret[k] = v.concat(appendValue);
1296
- break;
1297
- case types_1.CustomizeRule.Merge:
1298
- if (!bMatches.length) {
1299
- ret[k] = v;
1300
- break;
1301
- }
1302
- var lastValue = last(bMatches)[k];
1303
- if (!(0, utils_1.isPlainObject)(v) || !(0, utils_1.isPlainObject)(lastValue)) throw TypeError("Trying to merge non-objects");
1304
- ret[k] = merge(v, lastValue);
1305
- break;
1306
- case types_1.CustomizeRule.Prepend:
1307
- if (!bMatches.length) {
1308
- ret[k] = v;
1309
- break;
1310
- }
1311
- var prependValue = last(bMatches)[k];
1312
- if (!isArray(v) || !isArray(prependValue)) throw TypeError("Trying to prepend non-arrays");
1313
- ret[k] = prependValue.concat(v);
1314
- break;
1315
- case types_1.CustomizeRule.Replace:
1316
- ret[k] = bMatches.length > 0 ? last(bMatches)[k] : v;
1317
- break;
1318
- default:
1319
- var currentRule_1 = operations[k], b_1 = bMatches.map(function(o) {
1320
- return o[k];
1321
- }).reduce(function(acc, val) {
1322
- return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc), !1), __read(val), !1) : acc;
1323
- }, []);
1324
- ret[k] = mergeWithRule({
1325
- currentRule: currentRule_1,
1326
- a: v,
1327
- b: b_1
1328
- });
1329
- }
1330
- }), ret) : ao;
1331
- }).concat(b.filter(function(o) {
1332
- return !bAllMatches.includes(o);
1333
- }));
1334
- }
1335
- function mergeIndividualRule(_a) {
1336
- var currentRule = _a.currentRule, a = _a.a, b = _a.b;
1337
- switch(currentRule){
1338
- case types_1.CustomizeRule.Append:
1339
- return a.concat(b);
1340
- case types_1.CustomizeRule.Prepend:
1341
- return b.concat(a);
1342
- case types_1.CustomizeRule.Replace:
1343
- return b;
1344
- }
1345
- return a;
1346
- }
1347
- function last(arr) {
1348
- return arr[arr.length - 1];
1349
- }
1350
- exports.customizeObject = function customizeObject(rules) {
1351
- return function(a, b, key) {
1352
- switch(rules[key]){
1353
- case types_1.CustomizeRule.Prepend:
1354
- return (0, merge_with_1.default)([
1355
- b,
1356
- a
1357
- ], (0, join_arrays_1.default)());
1358
- case types_1.CustomizeRule.Replace:
1359
- return b;
1360
- case types_1.CustomizeRule.Append:
1361
- return (0, merge_with_1.default)([
1362
- a,
1363
- b
1364
- ], (0, join_arrays_1.default)());
1365
- }
1366
- };
1367
- };
1368
- },
1369
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js": function(__unused_webpack_module, exports, __webpack_require__) {
1370
- var __read = this && this.__read || function(o, n) {
1371
- var m = "function" == typeof Symbol && o[Symbol.iterator];
1372
- if (!m) return o;
1373
- var r, e, i = m.call(o), ar = [];
1374
- try {
1375
- for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1376
- } catch (error) {
1377
- e = {
1378
- error: error
1379
- };
1380
- } finally{
1381
- try {
1382
- r && !r.done && (m = i.return) && m.call(i);
1383
- } finally{
1384
- if (e) throw e.error;
1385
- }
1386
- }
1387
- return ar;
1388
- }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
1389
- if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
1390
- return to.concat(ar || Array.prototype.slice.call(from));
1391
- }, __importDefault = this && this.__importDefault || function(mod) {
1392
- return mod && mod.__esModule ? mod : {
1393
- default: mod
1394
- };
1395
- };
1396
- Object.defineProperty(exports, "__esModule", {
1397
- value: !0
1398
- });
1399
- var clone_deep_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js")), merge_with_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js")), utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js"), isArray = Array.isArray;
1400
- function joinArrays(_a) {
1401
- var _b = void 0 === _a ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
1402
- return function _joinArrays(a, b, k) {
1403
- var newKey = key ? "".concat(key, ".").concat(k) : k;
1404
- if ((0, utils_1.isFunction)(a) && (0, utils_1.isFunction)(b)) return function() {
1405
- for(var args = [], _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i];
1406
- return _joinArrays(a.apply(void 0, __spreadArray([], __read(args), !1)), b.apply(void 0, __spreadArray([], __read(args), !1)), k);
1407
- };
1408
- if (isArray(a) && isArray(b)) {
1409
- var customResult = customizeArray && customizeArray(a, b, newKey);
1410
- return customResult || __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
1411
- }
1412
- if ((0, utils_1.isRegex)(b)) return b;
1413
- if ((0, utils_1.isPlainObject)(a) && (0, utils_1.isPlainObject)(b)) {
1414
- var customResult = customizeObject && customizeObject(a, b, newKey);
1415
- return customResult || (0, merge_with_1.default)([
1416
- a,
1417
- b
1418
- ], joinArrays({
1419
- customizeArray: customizeArray,
1420
- customizeObject: customizeObject,
1421
- key: newKey
1422
- }));
1423
- }
1424
- return (0, utils_1.isPlainObject)(b) ? (0, clone_deep_1.default)(b) : isArray(b) ? __spreadArray([], __read(b), !1) : b;
1425
- };
1426
- }
1427
- exports.default = joinArrays;
1428
- },
1429
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js": function(__unused_webpack_module, exports) {
1430
- var __read = this && this.__read || function(o, n) {
1431
- var m = "function" == typeof Symbol && o[Symbol.iterator];
1432
- if (!m) return o;
1433
- var r, e, i = m.call(o), ar = [];
1434
- try {
1435
- for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1436
- } catch (error) {
1437
- e = {
1438
- error: error
1439
- };
1440
- } finally{
1441
- try {
1442
- r && !r.done && (m = i.return) && m.call(i);
1443
- } finally{
1444
- if (e) throw e.error;
1445
- }
1446
- }
1447
- return ar;
1448
- };
1449
- function mergeTo(a, b, customizer) {
1450
- var ret = {};
1451
- return Object.keys(a).concat(Object.keys(b)).forEach(function(k) {
1452
- var v = customizer(a[k], b[k], k);
1453
- ret[k] = void 0 === v ? a[k] : v;
1454
- }), ret;
1455
- }
1456
- Object.defineProperty(exports, "__esModule", {
1457
- value: !0
1458
- }), exports.default = function mergeWith(objects, customizer) {
1459
- var _a = __read(objects), first = _a[0], rest = _a.slice(1), ret = first;
1460
- return rest.forEach(function(a) {
1461
- ret = mergeTo(ret, a, customizer);
1462
- }), ret;
1463
- };
1464
- },
1465
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js": function(__unused_webpack_module, exports) {
1466
- var CustomizeRule, CustomizeRule1;
1467
- Object.defineProperty(exports, "__esModule", {
1468
- value: !0
1469
- }), exports.CustomizeRule = void 0, (CustomizeRule1 = CustomizeRule || (exports.CustomizeRule = CustomizeRule = {})).Match = "match", CustomizeRule1.Merge = "merge", CustomizeRule1.Append = "append", CustomizeRule1.Prepend = "prepend", CustomizeRule1.Replace = "replace";
1470
- },
1471
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js": function(__unused_webpack_module, exports) {
1472
- var __read = this && this.__read || function(o, n) {
1473
- var m = "function" == typeof Symbol && o[Symbol.iterator];
1474
- if (!m) return o;
1475
- var r, e, i = m.call(o), ar = [];
1476
- try {
1477
- for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1478
- } catch (error) {
1479
- e = {
1480
- error: error
1481
- };
1482
- } finally{
1483
- try {
1484
- r && !r.done && (m = i.return) && m.call(i);
1485
- } finally{
1486
- if (e) throw e.error;
1487
- }
1488
- }
1489
- return ar;
1490
- }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
1491
- if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
1492
- return to.concat(ar || Array.prototype.slice.call(from));
1493
- };
1494
- Object.defineProperty(exports, "__esModule", {
1495
- value: !0
1496
- }), exports.default = function mergeUnique(key, uniques, getter) {
1497
- var uniquesSet = new Set(uniques);
1498
- return function(a, b, k) {
1499
- return k === key && Array.from(__spreadArray(__spreadArray([], __read(a), !1), __read(b), !1).map(function(it) {
1500
- return {
1501
- key: getter(it),
1502
- value: it
1503
- };
1504
- }).map(function(_a) {
1505
- var key = _a.key, value = _a.value;
1506
- return {
1507
- key: uniquesSet.has(key) ? key : value,
1508
- value: value
1509
- };
1510
- }).reduce(function(m, _a) {
1511
- var key = _a.key, value = _a.value;
1512
- return m.delete(key), m.set(key, value);
1513
- }, new Map()).values());
1514
- };
1515
- };
1516
- },
1517
- "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js": function(__unused_webpack_module, exports, __webpack_require__) {
1518
- var __read = this && this.__read || function(o, n) {
1519
- var m = "function" == typeof Symbol && o[Symbol.iterator];
1520
- if (!m) return o;
1521
- var r, e, i = m.call(o), ar = [];
1522
- try {
1523
- for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1524
- } catch (error) {
1525
- e = {
1526
- error: error
1527
- };
1528
- } finally{
1529
- try {
1530
- r && !r.done && (m = i.return) && m.call(i);
1531
- } finally{
1532
- if (e) throw e.error;
1533
- }
1534
- }
1535
- return ar;
1536
- };
1537
- Object.defineProperty(exports, "__esModule", {
1538
- value: !0
1539
- }), exports.isSameCondition = exports.isUndefined = exports.isPlainObject = exports.isFunction = exports.isRegex = void 0;
1540
- var flat_1 = __webpack_require__("../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js");
1541
- function isRegex(o) {
1542
- return o instanceof RegExp;
1543
- }
1544
- function isFunction(functionToCheck) {
1545
- return functionToCheck && "[object Function]" === ({}).toString.call(functionToCheck);
1546
- }
1547
- exports.isRegex = isRegex, exports.isFunction = isFunction, exports.isPlainObject = function isPlainObject(a) {
1548
- return !(null === a || Array.isArray(a)) && "object" == typeof a;
1549
- }, exports.isUndefined = function isUndefined(a) {
1550
- return void 0 === a;
1551
- }, exports.isSameCondition = function isSameCondition(a, b) {
1552
- if (!a || !b) return a === b;
1553
- if ("string" == typeof a || "string" == typeof b || isRegex(a) || isRegex(b) || isFunction(a) || isFunction(b)) return a.toString() === b.toString();
1554
- var _a, _b, entriesA = Object.entries((0, flat_1.flatten)(a)), entriesB = Object.entries((0, flat_1.flatten)(b));
1555
- if (entriesA.length !== entriesB.length) return !1;
1556
- for(var i = 0; i < entriesA.length; i++)entriesA[i][0] = entriesA[i][0].replace(/\b\d+\b/g, "[]"), entriesB[i][0] = entriesB[i][0].replace(/\b\d+\b/g, "[]");
1557
- function cmp(_a, _b) {
1558
- var _c = __read(_a, 2), k1 = _c[0], v1 = _c[1], _d = __read(_b, 2), k2 = _d[0], v2 = _d[1];
1559
- return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
1560
- }
1561
- if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
1562
- for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null == (_a = entriesA[i][1]) ? void 0 : _a.toString()) !== (null == (_b = entriesB[i][1]) ? void 0 : _b.toString())) return !1;
1563
- return !0;
1564
- };
1565
- },
1566
- "../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js": function(module) {
1567
- var REGEXP_PARTS = /(\*|\?)/g;
1568
- function WildcardMatcher(text, separator) {
1569
- this.text = text = text || '', this.hasWild = text.indexOf('*') >= 0, this.separator = separator, this.parts = text.split(separator).map(this.classifyPart.bind(this));
1570
- }
1571
- WildcardMatcher.prototype.match = function(input) {
1572
- var ii, testParts, matches = !0, parts = this.parts, partsCount = parts.length;
1573
- if ('string' == typeof input || input instanceof String) if (this.hasWild || this.text == input) {
1574
- for(ii = 0, testParts = (input || '').split(this.separator); matches && ii < partsCount; ii++)if ('*' === parts[ii]) continue;
1575
- else matches = ii < testParts.length && (parts[ii] instanceof RegExp ? parts[ii].test(testParts[ii]) : parts[ii] === testParts[ii]);
1576
- matches = matches && testParts;
1577
- } else matches = !1;
1578
- else if ('function' == typeof input.splice) for(matches = [], ii = input.length; ii--;)this.match(input[ii]) && (matches[matches.length] = input[ii]);
1579
- else if ('object' == typeof input) for(var key in matches = {}, input)this.match(key) && (matches[key] = input[key]);
1580
- return matches;
1581
- }, WildcardMatcher.prototype.classifyPart = function(part) {
1582
- if ('*' === part) ;
1583
- else if (part.indexOf('*') >= 0 || part.indexOf('?') >= 0) return new RegExp(part.replace(REGEXP_PARTS, '\.$1'));
1584
- return part;
1585
- }, module.exports = function(text, test, separator) {
1586
- var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
1587
- return void 0 !== test ? matcher.match(test) : matcher;
1588
- };
1589
- },
1590
912
  async_hooks: function(module) {
1591
913
  module.exports = __rspack_external_async_hooks;
1592
914
  },
@@ -1629,7 +951,7 @@ __webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(p
1629
951
  setCssExtractPlugin: ()=>setCssExtractPlugin,
1630
952
  setHTMLPlugin: ()=>setHTMLPlugin
1631
953
  });
1632
- let external_node_module_ = __webpack_require__("node:module"), rspack_rspack = (0, external_node_module_.createRequire)(import.meta.url)('@rspack/core'), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), constants_filename = (0, external_node_url_.fileURLToPath)(import.meta.url), constants_dirname = (0, external_node_path_.dirname)(constants_filename), isDeno = 'undefined' != typeof Deno, isWindows = 'win32' === process.platform, ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(constants_dirname), STATIC_PATH = (0, external_node_path_.join)(constants_dirname, '../static'), COMPILED_PATH = (0, external_node_path_.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
954
+ let external_node_module_ = __webpack_require__("node:module"), rspack_rspack = (0, external_node_module_.createRequire)(import.meta.url)('@rspack/core'), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), constants_filename = (0, external_node_url_.fileURLToPath)(import.meta.url), constants_dirname = (0, external_node_path_.dirname)(constants_filename), isDeno = 'undefined' != typeof Deno, isWindows = 'win32' === process.platform, ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(constants_dirname), STATIC_PATH = (0, external_node_path_.join)(constants_dirname, '../static'), CLIENT_PATH = (0, external_node_path_.join)(constants_dirname, 'client'), COMPILED_PATH = (0, external_node_path_.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
1633
955
  'chrome >= 87',
1634
956
  'edge >= 88',
1635
957
  'firefox >= 78',
@@ -3422,7 +2744,7 @@ let OVERRIDE_PATHS = new Set([
3422
2744
  'resolve.conditionNames',
3423
2745
  'resolve.mainFields',
3424
2746
  'provider'
3425
- ]), merge = (x, y, path = '')=>{
2747
+ ]), mergeConfig_merge = (x, y, path = '')=>{
3426
2748
  if (((key)=>{
3427
2749
  if (key.startsWith('environments.')) {
3428
2750
  let realKey = key.split('.').slice(2).join('.');
@@ -3455,7 +2777,7 @@ let OVERRIDE_PATHS = new Set([
3455
2777
  ...Object.keys(y)
3456
2778
  ])){
3457
2779
  let childPath = path ? `${path}.${key}` : key;
3458
- merged[key] = merge(x[key], y[key], childPath);
2780
+ merged[key] = mergeConfig_merge(x[key], y[key], childPath);
3459
2781
  }
3460
2782
  return merged;
3461
2783
  }, normalizeConfigStructure = (config)=>{
@@ -3475,7 +2797,7 @@ let OVERRIDE_PATHS = new Set([
3475
2797
  ]), normalizedConfig.dev = dev), normalizedConfig;
3476
2798
  }, mergeRsbuildConfig = (...originalConfigs)=>{
3477
2799
  let configs = originalConfigs.filter((config)=>void 0 !== config).map(normalizeConfigStructure);
3478
- return 2 === configs.length ? merge(configs[0], configs[1]) : 1 === configs.length ? configs[0] : 0 === configs.length ? {} : configs.reduce((result, config)=>merge(result, config), {});
2800
+ return 2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : 1 === configs.length ? configs[0] : 0 === configs.length ? {} : configs.reduce((result, config)=>mergeConfig_merge(result, config), {});
3479
2801
  }, defaultConfig_require = (0, external_node_module_.createRequire)(import.meta.url), defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, createDefaultConfig = ()=>({
3480
2802
  dev: {
3481
2803
  hmr: !0,
@@ -4084,7 +3406,7 @@ function createPublicContext(context) {
4084
3406
  async function createContext(options, userConfig) {
4085
3407
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
4086
3408
  return {
4087
- version: "1.6.10",
3409
+ version: "1.6.11",
4088
3410
  rootPath,
4089
3411
  distPath: '',
4090
3412
  cachePath,
@@ -4343,7 +3665,7 @@ let configChain_CHAIN_ID = {
4343
3665
  plugin && (pluginHelper_htmlPlugin = plugin);
4344
3666
  }, pluginHelper_getHTMLPlugin = (config)=>config?.html.implementation === 'native' ? rspack_rspack.HtmlRspackPlugin : (pluginHelper_htmlPlugin || (pluginHelper_htmlPlugin = requireCompiledPackage('html-rspack-plugin')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
4345
3667
  cssExtractPlugin = plugin;
4346
- }, dist_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js");
3668
+ };
4347
3669
  async function modifyRspackConfig(context, rspackConfig, chainUtils) {
4348
3670
  logger.debug('applying modifyRspackConfig hook');
4349
3671
  let currentConfig = rspackConfig, utils = getConfigUtils(()=>currentConfig, chainUtils);
@@ -4370,7 +3692,10 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
4370
3692
  function getConfigUtils(getCurrentConfig, chainUtils) {
4371
3693
  return {
4372
3694
  ...chainUtils,
4373
- mergeConfig: dist_1.merge,
3695
+ mergeConfig: (...args)=>{
3696
+ let { merge } = requireCompiledPackage('webpack-merge');
3697
+ return merge(...args);
3698
+ },
4374
3699
  addRules (rules) {
4375
3700
  let config = getCurrentConfig(), ruleArr = helpers_castArray(rules);
4376
3701
  config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
@@ -6417,8 +5742,8 @@ function applyHMREntry({ config, compiler, token, resolvedHost, resolvedPort })
6417
5742
  ...config.dev.client
6418
5743
  };
6419
5744
  '<port>' === clientConfig.port && (clientConfig.port = resolvedPort);
6420
- let hmrEntry = `import { init } from '@rsbuild/core/client/hmr';
6421
- ${config.dev.client.overlay ? "import '@rsbuild/core/client/overlay';" : ''}
5745
+ let hmrEntry = `import { init } from '${toPosixPath((0, external_node_path_.join)(CLIENT_PATH, 'hmr'))}';
5746
+ ${config.dev.client.overlay ? `import '${toPosixPath((0, external_node_path_.join)(CLIENT_PATH, 'overlay'))}';` : ''}
6422
5747
 
6423
5748
  init({
6424
5749
  token: '${token}',
@@ -6451,27 +5776,34 @@ let assets_middleware_assetsMiddleware = async ({ config, compiler, context, soc
6451
5776
  let { target } = compiler.options;
6452
5777
  return !!target && (Array.isArray(target) ? target.includes('node') : 'node' === target);
6453
5778
  })(compiler)) return;
6454
- let errorsCount = null;
5779
+ let errorsCount = null, warningsCount = null;
6455
5780
  compiler.hooks.invalid.tap('rsbuild-dev-server', (fileName)=>{
6456
- errorsCount = null, 'string' == typeof fileName && fileName.endsWith('.html') && socketServer.sockWrite({
5781
+ errorsCount = null, warningsCount = null, 'string' == typeof fileName && fileName.endsWith('.html') && socketServer.sockWrite({
6457
5782
  type: 'static-changed'
6458
5783
  }, token);
6459
5784
  }), compiler.hooks.done.tap('rsbuild-dev-server', (stats)=>{
6460
- let { errors } = stats.compilation;
6461
- if (errors.length === errorsCount) return;
6462
- let isRecalled = null !== errorsCount;
6463
- if (errorsCount = errors.length, isRecalled) {
6464
- let tsErrors = errors.filter(isTsError);
6465
- if (!tsErrors.length) return;
6466
- let { stats: statsJson } = context.buildState, statsErrors = tsErrors.map((item)=>pick(item, [
6467
- 'message',
6468
- 'file'
6469
- ]));
6470
- statsJson && (statsJson.errors = statsJson.errors ? [
6471
- ...statsJson.errors,
6472
- ...statsErrors
6473
- ] : statsErrors), socketServer.sendError(statsErrors, token);
6474
- return;
5785
+ let { errors, warnings } = stats.compilation;
5786
+ if (errors.length === errorsCount && warnings.length === warningsCount) return;
5787
+ let isRecalled = null !== errorsCount || null !== warningsCount;
5788
+ if (errorsCount = errors.length, warningsCount = warnings.length, isRecalled) {
5789
+ let tsErrors = errors.filter(isTsError), tsWarnings = warnings.filter(isTsError);
5790
+ if (!tsErrors.length && !tsWarnings.length) return;
5791
+ let { stats: statsJson } = context.buildState, handleTsIssues = (issues, type, sendFn)=>{
5792
+ let statsIssues = issues.map((item)=>pick(item, [
5793
+ 'message',
5794
+ 'file'
5795
+ ]));
5796
+ statsJson && (statsJson[type] = statsJson[type] ? [
5797
+ ...statsJson[type],
5798
+ ...statsIssues
5799
+ ] : statsIssues), sendFn(statsIssues, token);
5800
+ };
5801
+ if (tsErrors.length > 0) return void handleTsIssues(tsErrors, 'errors', (issues, token)=>{
5802
+ socketServer.sendError(issues, token);
5803
+ });
5804
+ if (tsWarnings.length > 0) return void handleTsIssues(tsWarnings, 'warnings', (issues, token)=>{
5805
+ socketServer.sendWarning(issues, token);
5806
+ });
6475
5807
  }
6476
5808
  });
6477
5809
  })({
@@ -6914,6 +6246,15 @@ class SocketServer {
6914
6246
  }
6915
6247
  }, token);
6916
6248
  }
6249
+ sendWarning(warnings, token) {
6250
+ let formattedWarnings = warnings.map((item)=>formatStatsError(item));
6251
+ this.sockWrite({
6252
+ type: 'warnings',
6253
+ data: {
6254
+ text: formattedWarnings
6255
+ }
6256
+ }, token);
6257
+ }
6917
6258
  sockWrite(message, token) {
6918
6259
  let messageStr = JSON.stringify(message), sendToSockets = (sockets)=>{
6919
6260
  for (let socket of sockets)this.send(socket, messageStr);
@@ -6991,18 +6332,7 @@ class SocketServer {
6991
6332
  data: stats.hash
6992
6333
  }, token);
6993
6334
  }
6994
- if (errors.length > 0) return void this.sendError(errors, token);
6995
- if (warnings.length > 0) {
6996
- let warningMessages = warnings.map((item)=>formatStatsError(item));
6997
- this.sockWrite({
6998
- type: 'warnings',
6999
- data: {
7000
- text: warningMessages
7001
- }
7002
- }, token);
7003
- return;
7004
- }
7005
- this.sockWrite({
6335
+ errors.length > 0 ? this.sendError(errors, token) : warnings.length > 0 ? this.sendWarning(warnings, token) : this.sockWrite({
7006
6336
  type: 'ok'
7007
6337
  }, token);
7008
6338
  }
@@ -7106,35 +6436,34 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
7106
6436
  };
7107
6437
  }
7108
6438
  let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xml/i, gzipMiddleware_gzipMiddleware = ({ filter, level = node_zlib.constants.Z_BEST_SPEED } = {})=>function gzipMiddleware(req, res, next) {
7109
- let gzip, writeHeadStatus;
6439
+ let gzip, writeHeadStatus, writeHeadMessage;
7110
6440
  if (filter && !filter(req, res)) return void next();
7111
6441
  let accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
7112
6442
  if ('HEAD' === req.method || !encoding) return void next();
7113
6443
  let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = [], start = ()=>{
7114
- if (!started) {
7115
- if (started = !0, ((res)=>{
7116
- if (res.getHeader('Content-Encoding')) return !1;
7117
- let contentType = String(res.getHeader('Content-Type'));
7118
- if (contentType && !CONTENT_TYPE_REGEX.test(contentType)) return !1;
7119
- let size = res.getHeader('Content-Length');
7120
- return void 0 === size || Number(size) > 1024;
7121
- })(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = node_zlib.createGzip({
7122
- level
7123
- })).on('data', (chunk)=>{
7124
- write(chunk) || gzip.pause();
7125
- }), on('drain', ()=>gzip.resume()), gzip.on('end', ()=>{
7126
- end();
7127
- }), listeners))gzip.on.apply(gzip, listener);
7128
- else for (let listener of listeners)on.apply(res, listener);
7129
- writeHead(writeHeadStatus ?? res.statusCode);
7130
- }
6444
+ if (started) return;
6445
+ if (started = !0, ((res)=>{
6446
+ if (res.getHeader('Content-Encoding')) return !1;
6447
+ let contentType = String(res.getHeader('Content-Type'));
6448
+ if (contentType && !CONTENT_TYPE_REGEX.test(contentType)) return !1;
6449
+ let size = res.getHeader('Content-Length');
6450
+ return void 0 === size || Number(size) > 1024;
6451
+ })(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = node_zlib.createGzip({
6452
+ level
6453
+ })).on('data', (chunk)=>{
6454
+ write(chunk) || gzip.pause();
6455
+ }), on('drain', ()=>gzip.resume()), gzip.on('end', ()=>{
6456
+ end();
6457
+ }), listeners))gzip.on.apply(gzip, listener);
6458
+ else for (let listener of listeners)on.apply(res, listener);
6459
+ let statusCode = writeHeadStatus ?? res.statusCode;
6460
+ void 0 !== writeHeadMessage ? writeHead(statusCode, writeHeadMessage) : writeHead(statusCode);
7131
6461
  };
7132
6462
  res.writeHead = (status, reason, headers)=>{
7133
- if ('string' == typeof reason) {
7134
- if (headers) for (let [key, value] of Object.entries(headers))res.setHeader(key, value);
7135
- res.statusMessage = reason;
7136
- } else if (reason) for (let [key, value] of Object.entries(reason))void 0 !== value && res.setHeader(key, value);
7137
- return writeHeadStatus = status, res;
6463
+ writeHeadStatus = status, 'string' == typeof reason && (writeHeadMessage = reason);
6464
+ let resolvedHeaders = 'string' == typeof reason ? headers : reason;
6465
+ if (resolvedHeaders) for (let [key, value] of Object.entries(resolvedHeaders))res.setHeader(key, value);
6466
+ return res;
7138
6467
  }, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip ? gzip.end(...args) : end.apply(res, args)), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on(type, listener) : listeners.push([
7139
6468
  type,
7140
6469
  listener
@@ -9718,7 +9047,7 @@ let applyServerOptions = (command)=>{
9718
9047
  };
9719
9048
  function setupCommands() {
9720
9049
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9721
- cli.version("1.6.10"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9050
+ cli.version("1.6.11"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9722
9051
  default: 'auto'
9723
9052
  }).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
9724
9053
  type: [
@@ -9787,7 +9116,7 @@ function initNodeEnv() {
9787
9116
  }
9788
9117
  function showGreeting() {
9789
9118
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9790
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.10\n`);
9119
+ logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.11\n`);
9791
9120
  }
9792
9121
  function setupLogLevel() {
9793
9122
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9808,7 +9137,7 @@ function runCLI() {
9808
9137
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9809
9138
  }
9810
9139
  }
9811
- let src_version = "1.6.10";
9140
+ let src_version = "1.6.11";
9812
9141
  import * as __rspack_external_node_module_ab9f2194 from "node:module";
9813
9142
  import { createRequire as __rspack_createRequire } from "node:module";
9814
9143
  import * as __rspack_external_node_url_e96de089 from "node:url";