@rsbuild/core 1.2.15 → 1.2.17

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/index.cjs CHANGED
@@ -1,5 +1,32 @@
1
+ /*! For license information please see index.cjs.LICENSE.txt */
1
2
  let __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
2
3
  var __webpack_modules__ = {
4
+ "../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
5
+ "use strict";
6
+ 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");
7
+ module.exports = function cloneDeep(val, instanceClone) {
8
+ switch(typeOf(val)){
9
+ case 'object':
10
+ return function(val, instanceClone) {
11
+ if ('function' == typeof instanceClone) return instanceClone(val);
12
+ if (instanceClone || isPlainObject(val)) {
13
+ let res = new val.constructor();
14
+ for(let key in val)res[key] = cloneDeep(val[key], instanceClone);
15
+ return res;
16
+ }
17
+ return val;
18
+ }(val, instanceClone);
19
+ case 'array':
20
+ return function(val, instanceClone) {
21
+ let res = new val.constructor(val.length);
22
+ for(let i = 0; i < val.length; i++)res[i] = cloneDeep(val[i], instanceClone);
23
+ return res;
24
+ }(val, instanceClone);
25
+ default:
26
+ return clone(val);
27
+ }
28
+ };
29
+ },
3
30
  "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
4
31
  "use strict";
5
32
  var isMergeableObject = function(value) {
@@ -232,6 +259,627 @@ var __webpack_modules__ = {
232
259
  };
233
260
  module.exports.configDotenv = DotenvModule.configDotenv, module.exports._configVault = DotenvModule._configVault, module.exports._parseVault = DotenvModule._parseVault, module.exports.config = DotenvModule.config, module.exports.decrypt = DotenvModule.decrypt, module.exports.parse = DotenvModule.parse, module.exports.populate = DotenvModule.populate, module.exports = DotenvModule;
234
261
  },
262
+ "../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js": function(module) {
263
+ function isBuffer(obj) {
264
+ return obj && obj.constructor && 'function' == typeof obj.constructor.isBuffer && obj.constructor.isBuffer(obj);
265
+ }
266
+ function keyIdentity(key) {
267
+ return key;
268
+ }
269
+ function flatten(target, opts) {
270
+ let delimiter = (opts = opts || {}).delimiter || '.', maxDepth = opts.maxDepth, transformKey = opts.transformKey || keyIdentity, output = {};
271
+ return !function step(object, prev, currentDepth) {
272
+ currentDepth = currentDepth || 1, Object.keys(object).forEach(function(key) {
273
+ 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);
274
+ if (!isarray && !isbuffer && ('[object Object]' === type || '[object Array]' === type) && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
275
+ output[newKey] = value;
276
+ });
277
+ }(target), output;
278
+ }
279
+ module.exports = flatten, flatten.flatten = flatten, flatten.unflatten = function unflatten(target, opts) {
280
+ let delimiter = (opts = opts || {}).delimiter || '.', overwrite = opts.overwrite || !1, transformKey = opts.transformKey || keyIdentity, result = {};
281
+ if (isBuffer(target) || '[object Object]' !== Object.prototype.toString.call(target)) return target;
282
+ function getkey(key) {
283
+ let parsedKey = Number(key);
284
+ return isNaN(parsedKey) || -1 !== key.indexOf('.') || opts.object ? key : parsedKey;
285
+ }
286
+ return Object.keys(target = Object.keys(target).reduce(function(result, key) {
287
+ var target1;
288
+ let type = Object.prototype.toString.call(target[key]);
289
+ return '[object Object]' !== type && '[object Array]' !== type || function(val) {
290
+ let type = Object.prototype.toString.call(val);
291
+ return !val || ('[object Array]' === type ? !val.length : '[object Object]' === type ? !Object.keys(val).length : void 0);
292
+ }(target[key]) ? (result[key] = target[key], result) : Object.keys(target1 = flatten(target[key], opts)).reduce(function(result, key1) {
293
+ return result[key + delimiter + key1] = target1[key1], result;
294
+ }, result);
295
+ }, {})).forEach(function(key) {
296
+ let split = key.split(delimiter).map(transformKey), key1 = getkey(split.shift()), key2 = getkey(split[0]), recipient = result;
297
+ for(; void 0 !== key2;){
298
+ if ('__proto__' === key1) return;
299
+ let type = Object.prototype.toString.call(recipient[key1]), isobject = '[object Object]' === type || '[object Array]' === type;
300
+ if (!overwrite && !isobject && void 0 !== recipient[key1]) return;
301
+ (!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]));
302
+ }
303
+ recipient[key1] = unflatten(target[key], opts);
304
+ }), result;
305
+ };
306
+ },
307
+ "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
308
+ "use strict";
309
+ var isObject = __webpack_require__("../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js");
310
+ function isObjectObject(o) {
311
+ return !0 === isObject(o) && '[object Object]' === Object.prototype.toString.call(o);
312
+ }
313
+ module.exports = function(o) {
314
+ var ctor, prot;
315
+ return !1 !== isObjectObject(o) && 'function' == typeof (ctor = o.constructor) && !1 !== isObjectObject(prot = ctor.prototype) && !1 !== prot.hasOwnProperty('isPrototypeOf');
316
+ };
317
+ },
318
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js": function(module) {
319
+ "use strict";
320
+ module.exports = function(val) {
321
+ return null != val && 'object' == typeof val && !1 === Array.isArray(val);
322
+ };
323
+ },
324
+ "../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js": function(module) {
325
+ var toString = Object.prototype.toString;
326
+ function ctorName(val) {
327
+ return 'function' == typeof val.constructor ? val.constructor.name : null;
328
+ }
329
+ module.exports = function(val) {
330
+ if (void 0 === val) return 'undefined';
331
+ if (null === val) return 'null';
332
+ var val1, val2, val3, val4, val5, val6, val7, type = typeof val;
333
+ if ('boolean' === type) return 'boolean';
334
+ if ('string' === type) return 'string';
335
+ if ('number' === type) return 'number';
336
+ if ('symbol' === type) return 'symbol';
337
+ if ('function' === type) {
338
+ return 'GeneratorFunction' === ctorName(val) ? 'generatorfunction' : 'function';
339
+ }
340
+ if (val2 = val, Array.isArray ? Array.isArray(val2) : val2 instanceof Array) return 'array';
341
+ if ((val3 = val).constructor && 'function' == typeof val3.constructor.isBuffer && val3.constructor.isBuffer(val3)) return 'buffer';
342
+ if (function(val) {
343
+ try {
344
+ if ('number' == typeof val.length && 'function' == typeof val.callee) return !0;
345
+ } catch (err) {
346
+ if (-1 !== err.message.indexOf('callee')) return !0;
347
+ }
348
+ return !1;
349
+ }(val)) return 'arguments';
350
+ if ((val4 = val) instanceof Date || 'function' == typeof val4.toDateString && 'function' == typeof val4.getDate && 'function' == typeof val4.setDate) return 'date';
351
+ if ((val5 = val) instanceof Error || 'string' == typeof val5.message && val5.constructor && 'number' == typeof val5.constructor.stackTraceLimit) return 'error';
352
+ if ((val6 = val) instanceof RegExp || 'string' == typeof val6.flags && 'boolean' == typeof val6.ignoreCase && 'boolean' == typeof val6.multiline && 'boolean' == typeof val6.global) return 'regexp';
353
+ switch(ctorName(val)){
354
+ case 'Symbol':
355
+ return 'symbol';
356
+ case 'Promise':
357
+ return 'promise';
358
+ case 'WeakMap':
359
+ return 'weakmap';
360
+ case 'WeakSet':
361
+ return 'weakset';
362
+ case 'Map':
363
+ return 'map';
364
+ case 'Set':
365
+ return 'set';
366
+ case 'Int8Array':
367
+ return 'int8array';
368
+ case 'Uint8Array':
369
+ return 'uint8array';
370
+ case 'Uint8ClampedArray':
371
+ return 'uint8clampedarray';
372
+ case 'Int16Array':
373
+ return 'int16array';
374
+ case 'Uint16Array':
375
+ return 'uint16array';
376
+ case 'Int32Array':
377
+ return 'int32array';
378
+ case 'Uint32Array':
379
+ return 'uint32array';
380
+ case 'Float32Array':
381
+ return 'float32array';
382
+ case 'Float64Array':
383
+ return 'float64array';
384
+ }
385
+ if ('function' == typeof (val7 = val).throw && 'function' == typeof val7.return && 'function' == typeof val7.next) return 'generator';
386
+ switch(type = toString.call(val)){
387
+ case '[object Object]':
388
+ return 'object';
389
+ case '[object Map Iterator]':
390
+ return 'mapiterator';
391
+ case '[object Set Iterator]':
392
+ return 'setiterator';
393
+ case '[object String Iterator]':
394
+ return 'stringiterator';
395
+ case '[object Array Iterator]':
396
+ return 'arrayiterator';
397
+ }
398
+ return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
399
+ };
400
+ },
401
+ "../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
402
+ "use strict";
403
+ let valueOf = Symbol.prototype.valueOf, typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js");
404
+ module.exports = function(val, deep) {
405
+ var val1, val2, deep1;
406
+ switch(typeOf(val)){
407
+ case 'array':
408
+ return val.slice();
409
+ case 'object':
410
+ return Object.assign({}, val);
411
+ case 'date':
412
+ return new val.constructor(Number(val));
413
+ case 'map':
414
+ return new Map(val);
415
+ case 'set':
416
+ return new Set(val);
417
+ case 'buffer':
418
+ return function(val) {
419
+ let len = val.length, buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
420
+ return val.copy(buf), buf;
421
+ }(val);
422
+ case 'symbol':
423
+ return val1 = val, valueOf ? Object(valueOf.call(val1)) : {};
424
+ case 'arraybuffer':
425
+ return function(val) {
426
+ let res = new val.constructor(val.byteLength);
427
+ return new Uint8Array(res).set(new Uint8Array(val)), res;
428
+ }(val);
429
+ case 'float32array':
430
+ case 'float64array':
431
+ case 'int16array':
432
+ case 'int32array':
433
+ case 'int8array':
434
+ case 'uint16array':
435
+ case 'uint32array':
436
+ case 'uint8clampedarray':
437
+ case 'uint8array':
438
+ return new (val2 = val).constructor(val2.buffer, val2.byteOffset, val2.length);
439
+ case 'regexp':
440
+ return function(val) {
441
+ let flags = void 0 !== val.flags ? val.flags : /\w+$/.exec(val) || void 0, re = new val.constructor(val.source, flags);
442
+ return re.lastIndex = val.lastIndex, re;
443
+ }(val);
444
+ case 'error':
445
+ return Object.create(val);
446
+ default:
447
+ return val;
448
+ }
449
+ };
450
+ },
451
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js": function(__unused_webpack_module, exports1, __webpack_require__) {
452
+ "use strict";
453
+ var __read = this && this.__read || function(o, n) {
454
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
455
+ if (!m) return o;
456
+ var r, e, i = m.call(o), ar = [];
457
+ try {
458
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
459
+ } catch (error) {
460
+ e = {
461
+ error: error
462
+ };
463
+ } finally{
464
+ try {
465
+ r && !r.done && (m = i.return) && m.call(i);
466
+ } finally{
467
+ if (e) throw e.error;
468
+ }
469
+ }
470
+ return ar;
471
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
472
+ 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]);
473
+ return to.concat(ar || Array.prototype.slice.call(from));
474
+ }, __importDefault = this && this.__importDefault || function(mod) {
475
+ return mod && mod.__esModule ? mod : {
476
+ default: mod
477
+ };
478
+ };
479
+ Object.defineProperty(exports1, "__esModule", {
480
+ value: !0
481
+ }), exports1.unique = exports1.mergeWithRules = exports1.mergeWithCustomize = exports1.default = exports1.merge = exports1.CustomizeRule = exports1.customizeObject = exports1.customizeArray = void 0;
482
+ 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")), unique_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js"));
483
+ exports1.unique = unique_1.default;
484
+ var types_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js");
485
+ Object.defineProperty(exports1, "CustomizeRule", {
486
+ enumerable: !0,
487
+ get: function() {
488
+ return types_1.CustomizeRule;
489
+ }
490
+ });
491
+ var utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js");
492
+ function merge(firstConfiguration) {
493
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
494
+ return mergeWithCustomize({}).apply(void 0, __spreadArray([
495
+ firstConfiguration
496
+ ], __read(configurations), !1));
497
+ }
498
+ function mergeWithCustomize(options) {
499
+ return function(firstConfiguration) {
500
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
501
+ if ((0, utils_1.isUndefined)(firstConfiguration) || configurations.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
502
+ if (firstConfiguration.then) throw TypeError("Promises are not supported");
503
+ if (!firstConfiguration) return {};
504
+ if (0 === configurations.length) {
505
+ if (Array.isArray(firstConfiguration)) {
506
+ if (0 === firstConfiguration.length) return {};
507
+ if (firstConfiguration.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
508
+ if (firstConfiguration[0].then) throw TypeError("Promises are not supported");
509
+ return (0, merge_with_1.default)(firstConfiguration, (0, join_arrays_1.default)(options));
510
+ }
511
+ return firstConfiguration;
512
+ }
513
+ return (0, merge_with_1.default)([
514
+ firstConfiguration
515
+ ].concat(configurations), (0, join_arrays_1.default)(options));
516
+ };
517
+ }
518
+ exports1.merge = merge, exports1.default = merge, exports1.mergeWithCustomize = mergeWithCustomize, exports1.customizeArray = function(rules) {
519
+ return function(a, b, key) {
520
+ var matchedRule = Object.keys(rules).find(function(rule) {
521
+ return (0, wildcard_1.default)(rule, key);
522
+ }) || "";
523
+ if (matchedRule) switch(rules[matchedRule]){
524
+ case types_1.CustomizeRule.Prepend:
525
+ return __spreadArray(__spreadArray([], __read(b), !1), __read(a), !1);
526
+ case types_1.CustomizeRule.Replace:
527
+ return b;
528
+ case types_1.CustomizeRule.Append:
529
+ default:
530
+ return __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
531
+ }
532
+ };
533
+ }, exports1.mergeWithRules = function(rules) {
534
+ return mergeWithCustomize({
535
+ customizeArray: function(a, b, key) {
536
+ var currentRule = rules;
537
+ return (key.split(".").forEach(function(k) {
538
+ currentRule && (currentRule = currentRule[k]);
539
+ }), (0, utils_1.isPlainObject)(currentRule)) ? function mergeWithRule(_a) {
540
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
541
+ if (!isArray(a)) return a;
542
+ var bAllMatches = [];
543
+ return a.map(function(ao) {
544
+ if (!(0, utils_1.isPlainObject)(currentRule)) return ao;
545
+ var ret = {}, rulesToMatch = [], operations = {};
546
+ Object.entries(currentRule).forEach(function(_a) {
547
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
548
+ v === types_1.CustomizeRule.Match ? rulesToMatch.push(k) : operations[k] = v;
549
+ });
550
+ var bMatches = b.filter(function(o) {
551
+ var matches = rulesToMatch.every(function(rule) {
552
+ return (0, utils_1.isSameCondition)(ao[rule], o[rule]);
553
+ });
554
+ return matches && bAllMatches.push(o), matches;
555
+ });
556
+ return (0, utils_1.isPlainObject)(ao) ? (Object.entries(ao).forEach(function(_a) {
557
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
558
+ switch(currentRule[k]){
559
+ case types_1.CustomizeRule.Match:
560
+ ret[k] = v, Object.entries(currentRule).forEach(function(_a) {
561
+ var _b = __read(_a, 2), k = _b[0];
562
+ if (_b[1] === types_1.CustomizeRule.Replace && bMatches.length > 0) {
563
+ var val = last(bMatches)[k];
564
+ void 0 !== val && (ret[k] = val);
565
+ }
566
+ });
567
+ break;
568
+ case types_1.CustomizeRule.Append:
569
+ if (!bMatches.length) {
570
+ ret[k] = v;
571
+ break;
572
+ }
573
+ var appendValue = last(bMatches)[k];
574
+ if (!isArray(v) || !isArray(appendValue)) throw TypeError("Trying to append non-arrays");
575
+ ret[k] = v.concat(appendValue);
576
+ break;
577
+ case types_1.CustomizeRule.Merge:
578
+ if (!bMatches.length) {
579
+ ret[k] = v;
580
+ break;
581
+ }
582
+ var lastValue = last(bMatches)[k];
583
+ if (!(0, utils_1.isPlainObject)(v) || !(0, utils_1.isPlainObject)(lastValue)) throw TypeError("Trying to merge non-objects");
584
+ ret[k] = merge(v, lastValue);
585
+ break;
586
+ case types_1.CustomizeRule.Prepend:
587
+ if (!bMatches.length) {
588
+ ret[k] = v;
589
+ break;
590
+ }
591
+ var prependValue = last(bMatches)[k];
592
+ if (!isArray(v) || !isArray(prependValue)) throw TypeError("Trying to prepend non-arrays");
593
+ ret[k] = prependValue.concat(v);
594
+ break;
595
+ case types_1.CustomizeRule.Replace:
596
+ ret[k] = bMatches.length > 0 ? last(bMatches)[k] : v;
597
+ break;
598
+ default:
599
+ var currentRule_1 = operations[k], b_1 = bMatches.map(function(o) {
600
+ return o[k];
601
+ }).reduce(function(acc, val) {
602
+ return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc), !1), __read(val), !1) : acc;
603
+ }, []);
604
+ ret[k] = mergeWithRule({
605
+ currentRule: currentRule_1,
606
+ a: v,
607
+ b: b_1
608
+ });
609
+ }
610
+ }), ret) : ao;
611
+ }).concat(b.filter(function(o) {
612
+ return !bAllMatches.includes(o);
613
+ }));
614
+ }({
615
+ currentRule: currentRule,
616
+ a: a,
617
+ b: b
618
+ }) : "string" == typeof currentRule ? function(_a) {
619
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
620
+ switch(currentRule){
621
+ case types_1.CustomizeRule.Append:
622
+ return a.concat(b);
623
+ case types_1.CustomizeRule.Prepend:
624
+ return b.concat(a);
625
+ case types_1.CustomizeRule.Replace:
626
+ return b;
627
+ }
628
+ return a;
629
+ }({
630
+ currentRule: currentRule,
631
+ a: a,
632
+ b: b
633
+ }) : void 0;
634
+ }
635
+ });
636
+ };
637
+ var isArray = Array.isArray;
638
+ function last(arr) {
639
+ return arr[arr.length - 1];
640
+ }
641
+ exports1.customizeObject = function(rules) {
642
+ return function(a, b, key) {
643
+ switch(rules[key]){
644
+ case types_1.CustomizeRule.Prepend:
645
+ return (0, merge_with_1.default)([
646
+ b,
647
+ a
648
+ ], (0, join_arrays_1.default)());
649
+ case types_1.CustomizeRule.Replace:
650
+ return b;
651
+ case types_1.CustomizeRule.Append:
652
+ return (0, merge_with_1.default)([
653
+ a,
654
+ b
655
+ ], (0, join_arrays_1.default)());
656
+ }
657
+ };
658
+ };
659
+ },
660
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js": function(__unused_webpack_module, exports1, __webpack_require__) {
661
+ "use strict";
662
+ var __read = this && this.__read || function(o, n) {
663
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
664
+ if (!m) return o;
665
+ var r, e, i = m.call(o), ar = [];
666
+ try {
667
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
668
+ } catch (error) {
669
+ e = {
670
+ error: error
671
+ };
672
+ } finally{
673
+ try {
674
+ r && !r.done && (m = i.return) && m.call(i);
675
+ } finally{
676
+ if (e) throw e.error;
677
+ }
678
+ }
679
+ return ar;
680
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
681
+ 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]);
682
+ return to.concat(ar || Array.prototype.slice.call(from));
683
+ }, __importDefault = this && this.__importDefault || function(mod) {
684
+ return mod && mod.__esModule ? mod : {
685
+ default: mod
686
+ };
687
+ };
688
+ Object.defineProperty(exports1, "__esModule", {
689
+ value: !0
690
+ });
691
+ 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;
692
+ exports1.default = function joinArrays(_a) {
693
+ var _b = void 0 === _a ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
694
+ return function _joinArrays(a, b, k) {
695
+ var newKey = key ? "".concat(key, ".").concat(k) : k;
696
+ if ((0, utils_1.isFunction)(a) && (0, utils_1.isFunction)(b)) return function() {
697
+ for(var args = [], _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i];
698
+ return _joinArrays(a.apply(void 0, __spreadArray([], __read(args), !1)), b.apply(void 0, __spreadArray([], __read(args), !1)), k);
699
+ };
700
+ if (isArray(a) && isArray(b)) {
701
+ var customResult = customizeArray && customizeArray(a, b, newKey);
702
+ return customResult || __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
703
+ }
704
+ if ((0, utils_1.isRegex)(b)) return b;
705
+ if ((0, utils_1.isPlainObject)(a) && (0, utils_1.isPlainObject)(b)) {
706
+ var customResult = customizeObject && customizeObject(a, b, newKey);
707
+ return customResult || (0, merge_with_1.default)([
708
+ a,
709
+ b
710
+ ], joinArrays({
711
+ customizeArray: customizeArray,
712
+ customizeObject: customizeObject,
713
+ key: newKey
714
+ }));
715
+ }
716
+ return (0, utils_1.isPlainObject)(b) ? (0, clone_deep_1.default)(b) : isArray(b) ? __spreadArray([], __read(b), !1) : b;
717
+ };
718
+ };
719
+ },
720
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js": function(__unused_webpack_module, exports1) {
721
+ "use strict";
722
+ var __read = this && this.__read || function(o, n) {
723
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
724
+ if (!m) return o;
725
+ var r, e, i = m.call(o), ar = [];
726
+ try {
727
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
728
+ } catch (error) {
729
+ e = {
730
+ error: error
731
+ };
732
+ } finally{
733
+ try {
734
+ r && !r.done && (m = i.return) && m.call(i);
735
+ } finally{
736
+ if (e) throw e.error;
737
+ }
738
+ }
739
+ return ar;
740
+ };
741
+ Object.defineProperty(exports1, "__esModule", {
742
+ value: !0
743
+ }), exports1.default = function(objects, customizer) {
744
+ var _a = __read(objects), first = _a[0], rest = _a.slice(1), ret = first;
745
+ return rest.forEach(function(a) {
746
+ var a1, b, customizer1, ret1;
747
+ a1 = ret, b = a, customizer1 = customizer, ret1 = {}, Object.keys(a1).concat(Object.keys(b)).forEach(function(k) {
748
+ var v = customizer1(a1[k], b[k], k);
749
+ ret1[k] = void 0 === v ? a1[k] : v;
750
+ }), ret = ret1;
751
+ }), ret;
752
+ };
753
+ },
754
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js": function(__unused_webpack_module, exports1) {
755
+ "use strict";
756
+ var CustomizeRule, CustomizeRule1;
757
+ Object.defineProperty(exports1, "__esModule", {
758
+ value: !0
759
+ }), exports1.CustomizeRule = void 0, (CustomizeRule1 = CustomizeRule || (exports1.CustomizeRule = CustomizeRule = {})).Match = "match", CustomizeRule1.Merge = "merge", CustomizeRule1.Append = "append", CustomizeRule1.Prepend = "prepend", CustomizeRule1.Replace = "replace";
760
+ },
761
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js": function(__unused_webpack_module, exports1) {
762
+ "use strict";
763
+ var __read = this && this.__read || function(o, n) {
764
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
765
+ if (!m) return o;
766
+ var r, e, i = m.call(o), ar = [];
767
+ try {
768
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
769
+ } catch (error) {
770
+ e = {
771
+ error: error
772
+ };
773
+ } finally{
774
+ try {
775
+ r && !r.done && (m = i.return) && m.call(i);
776
+ } finally{
777
+ if (e) throw e.error;
778
+ }
779
+ }
780
+ return ar;
781
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
782
+ 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]);
783
+ return to.concat(ar || Array.prototype.slice.call(from));
784
+ };
785
+ Object.defineProperty(exports1, "__esModule", {
786
+ value: !0
787
+ }), exports1.default = function(key, uniques, getter) {
788
+ var uniquesSet = new Set(uniques);
789
+ return function(a, b, k) {
790
+ return k === key && Array.from(__spreadArray(__spreadArray([], __read(a), !1), __read(b), !1).map(function(it) {
791
+ return {
792
+ key: getter(it),
793
+ value: it
794
+ };
795
+ }).map(function(_a) {
796
+ var key = _a.key, value = _a.value;
797
+ return {
798
+ key: uniquesSet.has(key) ? key : value,
799
+ value: value
800
+ };
801
+ }).reduce(function(m, _a) {
802
+ var key = _a.key, value = _a.value;
803
+ return m.delete(key), m.set(key, value);
804
+ }, new Map()).values());
805
+ };
806
+ };
807
+ },
808
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js": function(__unused_webpack_module, exports1, __webpack_require__) {
809
+ "use strict";
810
+ var __read = this && this.__read || function(o, n) {
811
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
812
+ if (!m) return o;
813
+ var r, e, i = m.call(o), ar = [];
814
+ try {
815
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
816
+ } catch (error) {
817
+ e = {
818
+ error: error
819
+ };
820
+ } finally{
821
+ try {
822
+ r && !r.done && (m = i.return) && m.call(i);
823
+ } finally{
824
+ if (e) throw e.error;
825
+ }
826
+ }
827
+ return ar;
828
+ };
829
+ Object.defineProperty(exports1, "__esModule", {
830
+ value: !0
831
+ }), exports1.isSameCondition = exports1.isUndefined = exports1.isPlainObject = exports1.isFunction = exports1.isRegex = void 0;
832
+ var flat_1 = __webpack_require__("../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js");
833
+ function isRegex(o) {
834
+ return o instanceof RegExp;
835
+ }
836
+ function isFunction(functionToCheck) {
837
+ return functionToCheck && "[object Function]" === ({}).toString.call(functionToCheck);
838
+ }
839
+ exports1.isRegex = isRegex, exports1.isFunction = isFunction, exports1.isPlainObject = function(a) {
840
+ return !(null === a || Array.isArray(a)) && "object" == typeof a;
841
+ }, exports1.isUndefined = function(a) {
842
+ return void 0 === a;
843
+ }, exports1.isSameCondition = function(a, b) {
844
+ if (!a || !b) return a === b;
845
+ if ("string" == typeof a || "string" == typeof b || isRegex(a) || isRegex(b) || isFunction(a) || isFunction(b)) return a.toString() === b.toString();
846
+ var _a, _b, entriesA = Object.entries((0, flat_1.flatten)(a)), entriesB = Object.entries((0, flat_1.flatten)(b));
847
+ if (entriesA.length !== entriesB.length) return !1;
848
+ 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, "[]");
849
+ function cmp(_a, _b) {
850
+ var _c = __read(_a, 2), k1 = _c[0], v1 = _c[1], _d = __read(_b, 2), k2 = _d[0], v2 = _d[1];
851
+ return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
852
+ }
853
+ if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
854
+ for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null === (_a = entriesA[i][1]) || void 0 === _a ? void 0 : _a.toString()) !== (null === (_b = entriesB[i][1]) || void 0 === _b ? void 0 : _b.toString())) return !1;
855
+ return !0;
856
+ };
857
+ },
858
+ "../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js": function(module) {
859
+ "use strict";
860
+ var REGEXP_PARTS = /(\*|\?)/g;
861
+ function WildcardMatcher(text, separator) {
862
+ this.text = text = text || '', this.hasWild = text.indexOf('*') >= 0, this.separator = separator, this.parts = text.split(separator).map(this.classifyPart.bind(this));
863
+ }
864
+ WildcardMatcher.prototype.match = function(input) {
865
+ var ii, testParts, matches = !0, parts = this.parts, partsCount = parts.length;
866
+ if ('string' == typeof input || input instanceof String) {
867
+ if (this.hasWild || this.text == input) {
868
+ for(ii = 0, testParts = (input || '').split(this.separator); matches && ii < partsCount; ii++)'*' !== parts[ii] && (matches = ii < testParts.length && (parts[ii] instanceof RegExp ? parts[ii].test(testParts[ii]) : parts[ii] === testParts[ii]));
869
+ matches = matches && testParts;
870
+ } else matches = !1;
871
+ } else if ('function' == typeof input.splice) for(matches = [], ii = input.length; ii--;)this.match(input[ii]) && (matches[matches.length] = input[ii]);
872
+ else if ('object' == typeof input) for(var key in matches = {}, input)this.match(key) && (matches[key] = input[key]);
873
+ return matches;
874
+ }, WildcardMatcher.prototype.classifyPart = function(part) {
875
+ if ('*' === part) ;
876
+ else if (part.indexOf('*') >= 0 || part.indexOf('?') >= 0) return new RegExp(part.replace(REGEXP_PARTS, '\.$1'));
877
+ return part;
878
+ }, module.exports = function(text, test, separator) {
879
+ var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
880
+ return void 0 !== test ? matcher.match(test) : matcher;
881
+ };
882
+ },
235
883
  crypto: function(module) {
236
884
  "use strict";
237
885
  module.exports = require("crypto");
@@ -304,10 +952,6 @@ var __webpack_modules__ = {
304
952
  "use strict";
305
953
  module.exports = import("../compiled/webpack-bundle-analyzer/index.js");
306
954
  },
307
- "../../compiled/webpack-merge/index.js": function(module) {
308
- "use strict";
309
- module.exports = import("../compiled/webpack-merge/index.js");
310
- },
311
955
  "../../compiled/ws/index.js": function(module) {
312
956
  "use strict";
313
957
  module.exports = import("../compiled/ws/index.js");
@@ -339,25 +983,19 @@ function __webpack_require__(moduleId) {
339
983
  var module = __webpack_module_cache__[moduleId] = {
340
984
  exports: {}
341
985
  };
342
- return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
986
+ return __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.exports;
343
987
  }
344
- __webpack_require__.n = function(module) {
345
- var getter = module && module.__esModule ? function() {
346
- return module.default;
347
- } : function() {
348
- return module;
349
- };
988
+ __webpack_require__.n = (module)=>{
989
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
350
990
  return __webpack_require__.d(getter, {
351
991
  a: getter
352
992
  }), getter;
353
- }, __webpack_require__.d = function(exports1, definition) {
993
+ }, __webpack_require__.d = (exports1, definition)=>{
354
994
  for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
355
995
  enumerable: !0,
356
996
  get: definition[key]
357
997
  });
358
- }, __webpack_require__.o = function(obj, prop) {
359
- return Object.prototype.hasOwnProperty.call(obj, prop);
360
- }, __webpack_require__.r = function(exports1) {
998
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = function(exports1) {
361
999
  'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
362
1000
  value: 'Module'
363
1001
  }), Object.defineProperty(exports1, '__esModule', {
@@ -369,18 +1007,18 @@ var __webpack_exports__ = {};
369
1007
  "use strict";
370
1008
  let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
371
1009
  __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
372
- ensureAssetPrefix: ()=>ensureAssetPrefix,
373
- PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
374
- mergeRsbuildConfig: ()=>mergeRsbuildConfig,
375
1010
  logger: ()=>rslog_index_js_namespaceObject.logger,
376
- loadEnv: ()=>loadEnv,
377
1011
  createRsbuild: ()=>createRsbuild,
378
1012
  rspack: ()=>core_namespaceObject.rspack,
1013
+ defineConfig: ()=>defineConfig,
1014
+ mergeRsbuildConfig: ()=>mergeRsbuildConfig,
379
1015
  runCLI: ()=>runCLI,
380
1016
  version: ()=>src_rslib_entry_version,
381
1017
  PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
1018
+ PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
382
1019
  loadConfig: ()=>config_loadConfig,
383
- defineConfig: ()=>defineConfig
1020
+ ensureAssetPrefix: ()=>ensureAssetPrefix,
1021
+ loadEnv: ()=>loadEnv
384
1022
  });
385
1023
  var provider_helpers_namespaceObject = {};
386
1024
  __webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(provider_helpers_namespaceObject, {
@@ -867,7 +1505,7 @@ var __webpack_exports__ = {};
867
1505
  }
868
1506
  function pickEnv(config, opts) {
869
1507
  let name;
870
- return 'object' != typeof config ? config : ('string' == typeof opts.env ? name = opts.env : process.env.BROWSERSLIST_ENV ? name = process.env.BROWSERSLIST_ENV : process.env.NODE_ENV ? name = process.env.NODE_ENV : name = 'production', config[name] || config.defaults);
1508
+ return 'object' != typeof config ? config : config['string' == typeof opts.env ? opts.env : process.env.BROWSERSLIST_ENV ? process.env.BROWSERSLIST_ENV : process.env.NODE_ENV ? process.env.NODE_ENV : 'production'] || config.defaults;
871
1509
  }
872
1510
  function eachParent(file, callback) {
873
1511
  let dir = isFile(file) ? external_node_path_namespaceObject.dirname(file) : file, loc = external_node_path_namespaceObject.resolve(dir);
@@ -894,7 +1532,7 @@ var __webpack_exports__ = {};
894
1532
  return OVERRIDE_PATHS.includes(realKey);
895
1533
  }
896
1534
  return OVERRIDE_PATHS.includes(key);
897
- }, mergeConfig_merge = (x, y, path = '')=>{
1535
+ }, merge = (x, y, path = '')=>{
898
1536
  if (isOverridePath(path)) return y ?? x;
899
1537
  if (void 0 === x) return isPlainObject(y) ? cloneDeep(y) : y;
900
1538
  if (void 0 === y) return isPlainObject(x) ? cloneDeep(x) : x;
@@ -915,10 +1553,10 @@ var __webpack_exports__ = {};
915
1553
  ...Object.keys(y)
916
1554
  ])){
917
1555
  let childPath = path ? `${path}.${key}` : key;
918
- merged[key] = mergeConfig_merge(x[key], y[key], childPath);
1556
+ merged[key] = merge(x[key], y[key], childPath);
919
1557
  }
920
1558
  return merged;
921
- }, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd;
1559
+ }, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd;
922
1560
  async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
923
1561
  cliOptions && (commonOpts = cliOptions);
924
1562
  try {
@@ -1239,7 +1877,7 @@ var __webpack_exports__ = {};
1239
1877
  ignorePermissionErrors: !0,
1240
1878
  ...watchOptions
1241
1879
  }), callback = (func = async (filePath)=>{
1242
- watcher.close(), isBuildWatch ? await restartBuild({
1880
+ await watcher.close(), isBuildWatch ? await restartBuild({
1243
1881
  filePath
1244
1882
  }) : await restartDevServer({
1245
1883
  filePath
@@ -1744,7 +2382,7 @@ var __webpack_exports__ = {};
1744
2382
  async function createContext(options, userConfig, bundlerType) {
1745
2383
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
1746
2384
  return {
1747
- version: "1.2.15",
2385
+ version: "1.2.17",
1748
2386
  rootPath,
1749
2387
  distPath: '',
1750
2388
  cachePath,
@@ -2372,9 +3010,26 @@ var __webpack_exports__ = {};
2372
3010
  localIdentName,
2373
3011
  emitCss
2374
3012
  });
2375
- rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions), rule.merge({
3013
+ rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions);
3014
+ let isStringExport = 'string' === cssLoaderOptions.exportType;
3015
+ if (isStringExport && rule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && rule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), rule.merge({
2376
3016
  sideEffects: !0
2377
- }), rule.resolve.preferRelative(!0);
3017
+ }), rule.resolve.preferRelative(!0), emitCss && !config.output.injectStyles && !isStringExport) {
3018
+ let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
3019
+ chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
3020
+ {
3021
+ filename: isCssFilenameFn ? (...args)=>{
3022
+ let name = cssFilename(...args);
3023
+ return external_node_path_namespaceObject.posix.join(cssPath, name);
3024
+ } : external_node_path_namespaceObject.posix.join(cssPath, cssFilename),
3025
+ chunkFilename: isCssFilenameFn ? (...args)=>{
3026
+ let name = cssFilename(...args);
3027
+ return external_node_path_namespaceObject.posix.join(cssAsyncPath, name);
3028
+ } : external_node_path_namespaceObject.posix.join(cssAsyncPath, cssFilename),
3029
+ ...extractPluginOptions
3030
+ }
3031
+ ]);
3032
+ }
2378
3033
  }
2379
3034
  });
2380
3035
  }
@@ -2464,21 +3119,24 @@ var __webpack_exports__ = {};
2464
3119
  if (0 === assets.length) return logs;
2465
3120
  logs.push(''), assets.sort((a, b)=>a.size - b.size);
2466
3121
  let longestLabelLength = Math.max(...assets.map((a)=>a.sizeLabel.length)), longestFileLength = Math.max(...assets.map((a)=>(a.folder + external_node_path_default().sep + a.name).length));
2467
- !1 !== options.detail && logs.push(function(longestFileLength, longestLabelLength, options, environmentName) {
2468
- let longestLengths = [
2469
- longestFileLength,
2470
- longestLabelLength
2471
- ], rowTypes = [
2472
- `File (${environmentName})`,
2473
- 'Size'
2474
- ];
2475
- options.compressed && rowTypes.push('Gzip');
2476
- let headerRow = rowTypes.reduce((prev, cur, index)=>{
2477
- let length = longestLengths[index], curLabel = cur;
2478
- return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
2479
- }, ' ');
2480
- return index_js_default().blue(headerRow);
2481
- }(longestFileLength, longestLabelLength, options, environmentName));
3122
+ if (!1 !== options.detail) {
3123
+ let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
3124
+ logs.push(function(longestFileLength, longestLabelLength, environmentName, showGzipHeader) {
3125
+ let longestLengths = [
3126
+ longestFileLength,
3127
+ longestLabelLength
3128
+ ], rowTypes = [
3129
+ `File (${environmentName})`,
3130
+ 'Size'
3131
+ ];
3132
+ showGzipHeader && rowTypes.push('Gzip');
3133
+ let headerRow = rowTypes.reduce((prev, cur, index)=>{
3134
+ let length = longestLengths[index], curLabel = cur;
3135
+ return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
3136
+ }, ' ');
3137
+ return index_js_default().blue(headerRow);
3138
+ }(longestFileLength, longestLabelLength, environmentName, showGzipHeader));
3139
+ }
2482
3140
  let totalSize = 0, totalGzipSize = 0;
2483
3141
  for (let asset of assets){
2484
3142
  let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + external_node_path_default().sep + name).length, sizeLength = sizeLabel.length;
@@ -3206,7 +3864,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3206
3864
  ...headTags,
3207
3865
  ...bodyTags
3208
3866
  ];
3209
- if (nonce) for (let tag of allTags)("script" === tag.tag || 'style' === tag.tag) && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
3867
+ if (nonce) for (let tag of allTags){
3868
+ var _tag_attrs, _tag_attrs1;
3869
+ ("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.rel) === 'preload' && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
3870
+ }
3210
3871
  return {
3211
3872
  headTags,
3212
3873
  bodyTags
@@ -3440,7 +4101,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3440
4101
  let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
3441
4102
  name: 'rsbuild:output',
3442
4103
  setup (api) {
3443
- api.modifyBundlerChain(async (chain, { CHAIN_ID, target, isProd, isServer, environment })=>{
4104
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
3444
4105
  let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
3445
4106
  var _context_devServer, _context_devServer1, _context_devServer2;
3446
4107
  let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || server.port || 3000;
@@ -3473,23 +4134,6 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3473
4134
  options
3474
4135
  ]);
3475
4136
  }
3476
- let emitCss = config.output.emitCss ?? 'web' === target;
3477
- if (!config.output.injectStyles && emitCss) {
3478
- let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
3479
- chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
3480
- {
3481
- filename: isCssFilenameFn ? (...args)=>{
3482
- let name = cssFilename(...args);
3483
- return external_node_path_namespaceObject.posix.join(cssPath, name);
3484
- } : external_node_path_namespaceObject.posix.join(cssPath, cssFilename),
3485
- chunkFilename: isCssFilenameFn ? (...args)=>{
3486
- let name = cssFilename(...args);
3487
- return external_node_path_namespaceObject.posix.join(cssAsyncPath, name);
3488
- } : external_node_path_namespaceObject.posix.join(cssAsyncPath, cssFilename),
3489
- ...extractPluginOptions
3490
- }
3491
- ]);
3492
- }
3493
4137
  });
3494
4138
  }
3495
4139
  }), pluginPerformance = ()=>({
@@ -3985,7 +4629,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3985
4629
  };
3986
4630
  'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
3987
4631
  let { chunkSplit } = config.performance, forceSplittingGroups = {};
3988
- chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting) {
4632
+ chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
3989
4633
  let cacheGroups = {};
3990
4634
  for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
3991
4635
  `force-split-${index}`,
@@ -3994,11 +4638,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3994
4638
  test: regexp,
3995
4639
  name: key,
3996
4640
  chunks: 'all',
3997
- priority: 0,
4641
+ priority: +('single-vendor' === strategy),
3998
4642
  enforce: !0
3999
4643
  };
4000
4644
  return cacheGroups;
4001
- }(chunkSplit.forceSplitting));
4645
+ }(chunkSplit.forceSplitting, chunkSplit.strategy));
4002
4646
  let override = 'custom' === chunkSplit.strategy ? chunkSplit.splitChunks ?? chunkSplit.override : chunkSplit.override, splitChunksOptions = await SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy || 'split-by-experience']({
4003
4647
  defaultConfig,
4004
4648
  override: override || {},
@@ -4256,6 +4900,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4256
4900
  }
4257
4901
  };
4258
4902
  }
4903
+ var dist = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js");
4259
4904
  async function modifyRspackConfig(context, rspackConfig, utils) {
4260
4905
  var _utils_environment_config_tools;
4261
4906
  rslog_index_js_namespaceObject.logger.debug('modify Rspack config');
@@ -4274,11 +4919,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4274
4919
  })), rslog_index_js_namespaceObject.logger.debug('modify Rspack config done'), modifiedConfig;
4275
4920
  }
4276
4921
  async function getConfigUtils(config, chainUtils) {
4277
- let { merge } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/webpack-merge/index.js"));
4278
4922
  return {
4279
4923
  ...chainUtils,
4280
4924
  rspack: core_namespaceObject.rspack,
4281
- mergeConfig: merge,
4925
+ mergeConfig: dist.merge,
4282
4926
  addRules (rules) {
4283
4927
  let ruleArr = castArray(rules);
4284
4928
  config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
@@ -4716,47 +5360,50 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4716
5360
  let curStats = this.stats[name];
4717
5361
  if (!curStats) return null;
4718
5362
  let statsOptions = getStatsOptions(curStats.compilation.compiler);
4719
- return curStats.toJson({
4720
- all: !1,
4721
- hash: !0,
4722
- assets: !0,
4723
- warnings: !0,
4724
- warningsCount: !0,
4725
- errors: !0,
4726
- errorsCount: !0,
4727
- errorDetails: !1,
4728
- entrypoints: !0,
4729
- children: !0,
4730
- moduleTrace: !0,
4731
- ...statsOptions
4732
- });
5363
+ return {
5364
+ statsJson: curStats.toJson({
5365
+ all: !1,
5366
+ hash: !0,
5367
+ assets: !0,
5368
+ warnings: !0,
5369
+ warningsCount: !0,
5370
+ errors: !0,
5371
+ errorsCount: !0,
5372
+ errorDetails: !1,
5373
+ entrypoints: !0,
5374
+ children: !0,
5375
+ moduleTrace: !0,
5376
+ ...statsOptions
5377
+ }),
5378
+ root: curStats.compilation.compiler.options.context
5379
+ };
4733
5380
  }
4734
5381
  sendStats({ force = !1, compilationId }) {
4735
- let stats = this.getStats(compilationId);
4736
- if (!stats) return null;
4737
- let newInitialChunks = new Set();
4738
- if (stats.entrypoints) for (let entrypoint of Object.values(stats.entrypoints)){
5382
+ let result = this.getStats(compilationId);
5383
+ if (!result) return null;
5384
+ let { statsJson, root } = result, newInitialChunks = new Set();
5385
+ if (statsJson.entrypoints) for (let entrypoint of Object.values(statsJson.entrypoints)){
4739
5386
  let chunks = entrypoint.chunks;
4740
5387
  if (Array.isArray(chunks)) for (let chunkName of chunks)chunkName && newInitialChunks.add(String(chunkName));
4741
5388
  }
4742
- let initialChunks = this.initialChunks[compilationId], shouldReload = !!stats.entrypoints && !!initialChunks && !(initialChunks.size === newInitialChunks.size && [
5389
+ let initialChunks = this.initialChunks[compilationId], shouldReload = !!statsJson.entrypoints && !!initialChunks && !(initialChunks.size === newInitialChunks.size && [
4743
5390
  ...initialChunks
4744
5391
  ].every((value)=>newInitialChunks.has(value)));
4745
5392
  if (this.initialChunks[compilationId] = newInitialChunks, shouldReload) return this.sockWrite({
4746
5393
  type: 'static-changed',
4747
5394
  compilationId
4748
5395
  });
4749
- if (!force && stats && !stats.errorsCount && stats.assets && stats.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
5396
+ if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
4750
5397
  type: 'still-ok',
4751
5398
  compilationId
4752
5399
  });
4753
5400
  if (this.sockWrite({
4754
5401
  type: 'hash',
4755
5402
  compilationId,
4756
- data: stats.hash
4757
- }), stats.errorsCount) {
5403
+ data: statsJson.hash
5404
+ }), statsJson.errorsCount) {
4758
5405
  let { errors: formattedErrors } = formatStatsMessages({
4759
- errors: getAllStatsErrors(stats),
5406
+ errors: getAllStatsErrors(statsJson),
4760
5407
  warnings: []
4761
5408
  });
4762
5409
  return this.sockWrite({
@@ -4764,10 +5411,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4764
5411
  compilationId,
4765
5412
  data: {
4766
5413
  text: formattedErrors,
4767
- html: function(errors) {
4768
- let htmlItems = errors.map((item)=>server_ansiHTML(item ? item.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;') : '').replace(/(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g, (file)=>{
4769
- let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file;
4770
- return `<a class="file-link" data-file="${filePath}">${filePath}</a>${hasClosingSpan ? '</span>' : ''}`;
5414
+ html: function(errors, root) {
5415
+ let htmlItems = errors.map((item)=>server_ansiHTML(item ? item.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;') : '').replace(/(?:\.\.?[\/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g, (file)=>{
5416
+ let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = external_node_path_default().isAbsolute(filePath), absolutePath = root && !isAbsolute ? external_node_path_default().join(root, filePath) : filePath, relativePath = root && isAbsolute ? function(base, filepath) {
5417
+ let relativePath = (0, external_node_path_namespaceObject.relative)(base, filepath);
5418
+ return '' === relativePath ? `.${external_node_path_namespaceObject.sep}` : relativePath.startsWith('.') ? relativePath : `.${external_node_path_namespaceObject.sep}${relativePath}`;
5419
+ }(root, filePath) : filePath;
5420
+ return `<a class="file-link" data-file="${absolutePath}">${relativePath}</a>${hasClosingSpan ? '</span>' : ''}`;
4771
5421
  }));
4772
5422
  return `
4773
5423
  <style>
@@ -4889,13 +5539,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4889
5539
  </div>
4890
5540
  </div>
4891
5541
  `;
4892
- }(formattedErrors)
5542
+ }(formattedErrors, root)
4893
5543
  }
4894
5544
  });
4895
5545
  }
4896
- if (stats.warningsCount) {
5546
+ if (statsJson.warningsCount) {
4897
5547
  let { warnings: formattedWarnings } = formatStatsMessages({
4898
- warnings: getAllStatsWarnings(stats),
5548
+ warnings: getAllStatsWarnings(statsJson),
4899
5549
  errors: []
4900
5550
  });
4901
5551
  return this.sockWrite({
@@ -5730,11 +6380,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5730
6380
  })).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
5731
6381
  return rslog_index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
5732
6382
  }
5733
- function cutPath(filePath, root) {
5734
- let prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep;
5735
- if (filePath.startsWith(prefix)) return filePath.slice(prefix.length);
5736
- let parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean);
5737
- return parts.length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
6383
+ function isLikelyFile(filePath) {
6384
+ return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
6385
+ }
6386
+ function formatFileList(paths, rootPath) {
6387
+ let files = paths.filter(isLikelyFile);
6388
+ 0 === files.length && (files = [
6389
+ paths[0]
6390
+ ]);
6391
+ let fileInfo = files.slice(0, 1).map((file)=>(function(originalFilePath, root) {
6392
+ let prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep, filePath = originalFilePath;
6393
+ filePath.startsWith(prefix) && (filePath = filePath.slice(prefix.length));
6394
+ let parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean);
6395
+ return parts.length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
6396
+ })(file, rootPath)).join(', ');
6397
+ return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
5738
6398
  }
5739
6399
  async function createCompiler_createCompiler(options) {
5740
6400
  rslog_index_js_namespaceObject.logger.debug('create compiler');
@@ -5747,17 +6407,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5747
6407
  isVersionLogged || (rslog_index_js_namespaceObject.logger.debug(`use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
5748
6408
  };
5749
6409
  compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
5750
- if (logRspackVersion(), !isCompiling) {
5751
- let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : [], removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : [];
5752
- if (changedFiles.length) {
5753
- let fileInfo = index_js_default().dim(changedFiles.map((file)=>cutPath(file, context.rootPath)).join(', '));
5754
- rslog_index_js_namespaceObject.logger.start(`building ${fileInfo}`);
5755
- } else if (removedFiles.length) {
5756
- let fileInfo = removedFiles.map((file)=>cutPath(file, context.rootPath)).join(', ');
6410
+ logRspackVersion(), isCompiling || function(compiler, context) {
6411
+ let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
6412
+ if (null == changedFiles ? void 0 : changedFiles.length) {
6413
+ let fileInfo = formatFileList(changedFiles, context.rootPath);
6414
+ rslog_index_js_namespaceObject.logger.start(`building ${index_js_default().dim(fileInfo)}`);
6415
+ return;
6416
+ }
6417
+ let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
6418
+ if (null == removedFiles ? void 0 : removedFiles.length) {
6419
+ let fileInfo = formatFileList(removedFiles, context.rootPath);
5757
6420
  rslog_index_js_namespaceObject.logger.start(`building ${index_js_default().dim(`removed ${fileInfo}`)}`);
5758
- } else rslog_index_js_namespaceObject.logger.start('build started...');
5759
- }
5760
- isCompiling = !0;
6421
+ return;
6422
+ }
6423
+ rslog_index_js_namespaceObject.logger.start('build started...');
6424
+ }(compiler, context), isCompiling = !0;
5761
6425
  }), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
5762
6426
  let done = (stats)=>{
5763
6427
  let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
@@ -6736,7 +7400,7 @@ ${section.body}` : section.body).join("\n\n"));
6736
7400
  }), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
6737
7401
  }
6738
7402
  }
6739
- let dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
7403
+ let cac_dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
6740
7404
  cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
6741
7405
  default: 'jiti'
6742
7406
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
@@ -6760,12 +7424,12 @@ ${section.body}` : section.body).join("\n\n"));
6760
7424
  }
6761
7425
  }(), process.title = 'rsbuild-node';
6762
7426
  let { npm_execpath } = process.env;
6763
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.15\n`);
7427
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.17\n`);
6764
7428
  }();
6765
7429
  try {
6766
7430
  !function() {
6767
- let cli = dist('rsbuild');
6768
- cli.help(), cli.version("1.2.15"), applyCommonOptions(cli);
7431
+ let cli = cac_dist('rsbuild');
7432
+ cli.help(), cli.version("1.2.17"), applyCommonOptions(cli);
6769
7433
  let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
6770
7434
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
6771
7435
  try {
@@ -6816,7 +7480,7 @@ ${section.body}` : section.body).join("\n\n"));
6816
7480
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
6817
7481
  }
6818
7482
  }
6819
- let src_rslib_entry_version = "1.2.15";
7483
+ let src_rslib_entry_version = "1.2.17";
6820
7484
  })();
6821
7485
  var __webpack_export_target__ = exports;
6822
7486
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];