@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.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
1
2
  let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
2
3
  import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
@@ -27,6 +28,31 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_querystring_aeb3c0b4__ from "node:que
27
28
  import * as __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__ from "node:vm";
28
29
  import * as __WEBPACK_EXTERNAL_MODULE_events__ from "events";
29
30
  var EsmMode, __webpack_modules__ = {
31
+ "../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
32
+ 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");
33
+ module.exports = function cloneDeep(val, instanceClone) {
34
+ switch(typeOf(val)){
35
+ case 'object':
36
+ return function(val, instanceClone) {
37
+ if ('function' == typeof instanceClone) return instanceClone(val);
38
+ if (instanceClone || isPlainObject(val)) {
39
+ let res = new val.constructor();
40
+ for(let key in val)res[key] = cloneDeep(val[key], instanceClone);
41
+ return res;
42
+ }
43
+ return val;
44
+ }(val, instanceClone);
45
+ case 'array':
46
+ return function(val, instanceClone) {
47
+ let res = new val.constructor(val.length);
48
+ for(let i = 0; i < val.length; i++)res[i] = cloneDeep(val[i], instanceClone);
49
+ return res;
50
+ }(val, instanceClone);
51
+ default:
52
+ return clone(val);
53
+ }
54
+ };
55
+ },
30
56
  "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
31
57
  var isMergeableObject = function(value) {
32
58
  var value1, value2, stringValue;
@@ -257,6 +283,617 @@ var EsmMode, __webpack_modules__ = {
257
283
  };
258
284
  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;
259
285
  },
286
+ "../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js": function(module) {
287
+ function isBuffer(obj) {
288
+ return obj && obj.constructor && 'function' == typeof obj.constructor.isBuffer && obj.constructor.isBuffer(obj);
289
+ }
290
+ function keyIdentity(key) {
291
+ return key;
292
+ }
293
+ function flatten(target, opts) {
294
+ let delimiter = (opts = opts || {}).delimiter || '.', maxDepth = opts.maxDepth, transformKey = opts.transformKey || keyIdentity, output = {};
295
+ return !function step(object, prev, currentDepth) {
296
+ currentDepth = currentDepth || 1, Object.keys(object).forEach(function(key) {
297
+ 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);
298
+ if (!isarray && !isbuffer && ('[object Object]' === type || '[object Array]' === type) && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
299
+ output[newKey] = value;
300
+ });
301
+ }(target), output;
302
+ }
303
+ module.exports = flatten, flatten.flatten = flatten, flatten.unflatten = function unflatten(target, opts) {
304
+ let delimiter = (opts = opts || {}).delimiter || '.', overwrite = opts.overwrite || !1, transformKey = opts.transformKey || keyIdentity, result = {};
305
+ if (isBuffer(target) || '[object Object]' !== Object.prototype.toString.call(target)) return target;
306
+ function getkey(key) {
307
+ let parsedKey = Number(key);
308
+ return isNaN(parsedKey) || -1 !== key.indexOf('.') || opts.object ? key : parsedKey;
309
+ }
310
+ return Object.keys(target = Object.keys(target).reduce(function(result, key) {
311
+ var target1;
312
+ let type = Object.prototype.toString.call(target[key]);
313
+ return '[object Object]' !== type && '[object Array]' !== type || function(val) {
314
+ let type = Object.prototype.toString.call(val);
315
+ return !val || ('[object Array]' === type ? !val.length : '[object Object]' === type ? !Object.keys(val).length : void 0);
316
+ }(target[key]) ? (result[key] = target[key], result) : Object.keys(target1 = flatten(target[key], opts)).reduce(function(result, key1) {
317
+ return result[key + delimiter + key1] = target1[key1], result;
318
+ }, result);
319
+ }, {})).forEach(function(key) {
320
+ let split = key.split(delimiter).map(transformKey), key1 = getkey(split.shift()), key2 = getkey(split[0]), recipient = result;
321
+ for(; void 0 !== key2;){
322
+ if ('__proto__' === key1) return;
323
+ let type = Object.prototype.toString.call(recipient[key1]), isobject = '[object Object]' === type || '[object Array]' === type;
324
+ if (!overwrite && !isobject && void 0 !== recipient[key1]) return;
325
+ (!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]));
326
+ }
327
+ recipient[key1] = unflatten(target[key], opts);
328
+ }), result;
329
+ };
330
+ },
331
+ "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
332
+ var isObject = __webpack_require__("../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js");
333
+ function isObjectObject(o) {
334
+ return !0 === isObject(o) && '[object Object]' === Object.prototype.toString.call(o);
335
+ }
336
+ module.exports = function(o) {
337
+ var ctor, prot;
338
+ return !1 !== isObjectObject(o) && 'function' == typeof (ctor = o.constructor) && !1 !== isObjectObject(prot = ctor.prototype) && !1 !== prot.hasOwnProperty('isPrototypeOf');
339
+ };
340
+ },
341
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js": function(module) {
342
+ module.exports = function(val) {
343
+ return null != val && 'object' == typeof val && !1 === Array.isArray(val);
344
+ };
345
+ },
346
+ "../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js": function(module) {
347
+ var toString = Object.prototype.toString;
348
+ function ctorName(val) {
349
+ return 'function' == typeof val.constructor ? val.constructor.name : null;
350
+ }
351
+ module.exports = function(val) {
352
+ if (void 0 === val) return 'undefined';
353
+ if (null === val) return 'null';
354
+ var val1, val2, val3, val4, val5, val6, val7, type = typeof val;
355
+ if ('boolean' === type) return 'boolean';
356
+ if ('string' === type) return 'string';
357
+ if ('number' === type) return 'number';
358
+ if ('symbol' === type) return 'symbol';
359
+ if ('function' === type) {
360
+ return 'GeneratorFunction' === ctorName(val) ? 'generatorfunction' : 'function';
361
+ }
362
+ if (val2 = val, Array.isArray ? Array.isArray(val2) : val2 instanceof Array) return 'array';
363
+ if ((val3 = val).constructor && 'function' == typeof val3.constructor.isBuffer && val3.constructor.isBuffer(val3)) return 'buffer';
364
+ if (function(val) {
365
+ try {
366
+ if ('number' == typeof val.length && 'function' == typeof val.callee) return !0;
367
+ } catch (err) {
368
+ if (-1 !== err.message.indexOf('callee')) return !0;
369
+ }
370
+ return !1;
371
+ }(val)) return 'arguments';
372
+ if ((val4 = val) instanceof Date || 'function' == typeof val4.toDateString && 'function' == typeof val4.getDate && 'function' == typeof val4.setDate) return 'date';
373
+ if ((val5 = val) instanceof Error || 'string' == typeof val5.message && val5.constructor && 'number' == typeof val5.constructor.stackTraceLimit) return 'error';
374
+ if ((val6 = val) instanceof RegExp || 'string' == typeof val6.flags && 'boolean' == typeof val6.ignoreCase && 'boolean' == typeof val6.multiline && 'boolean' == typeof val6.global) return 'regexp';
375
+ switch(ctorName(val)){
376
+ case 'Symbol':
377
+ return 'symbol';
378
+ case 'Promise':
379
+ return 'promise';
380
+ case 'WeakMap':
381
+ return 'weakmap';
382
+ case 'WeakSet':
383
+ return 'weakset';
384
+ case 'Map':
385
+ return 'map';
386
+ case 'Set':
387
+ return 'set';
388
+ case 'Int8Array':
389
+ return 'int8array';
390
+ case 'Uint8Array':
391
+ return 'uint8array';
392
+ case 'Uint8ClampedArray':
393
+ return 'uint8clampedarray';
394
+ case 'Int16Array':
395
+ return 'int16array';
396
+ case 'Uint16Array':
397
+ return 'uint16array';
398
+ case 'Int32Array':
399
+ return 'int32array';
400
+ case 'Uint32Array':
401
+ return 'uint32array';
402
+ case 'Float32Array':
403
+ return 'float32array';
404
+ case 'Float64Array':
405
+ return 'float64array';
406
+ }
407
+ if ('function' == typeof (val7 = val).throw && 'function' == typeof val7.return && 'function' == typeof val7.next) return 'generator';
408
+ switch(type = toString.call(val)){
409
+ case '[object Object]':
410
+ return 'object';
411
+ case '[object Map Iterator]':
412
+ return 'mapiterator';
413
+ case '[object Set Iterator]':
414
+ return 'setiterator';
415
+ case '[object String Iterator]':
416
+ return 'stringiterator';
417
+ case '[object Array Iterator]':
418
+ return 'arrayiterator';
419
+ }
420
+ return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
421
+ };
422
+ },
423
+ "../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
424
+ let valueOf = Symbol.prototype.valueOf, typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js");
425
+ module.exports = function(val, deep) {
426
+ var val1, val2, deep1;
427
+ switch(typeOf(val)){
428
+ case 'array':
429
+ return val.slice();
430
+ case 'object':
431
+ return Object.assign({}, val);
432
+ case 'date':
433
+ return new val.constructor(Number(val));
434
+ case 'map':
435
+ return new Map(val);
436
+ case 'set':
437
+ return new Set(val);
438
+ case 'buffer':
439
+ return function(val) {
440
+ let len = val.length, buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
441
+ return val.copy(buf), buf;
442
+ }(val);
443
+ case 'symbol':
444
+ return val1 = val, valueOf ? Object(valueOf.call(val1)) : {};
445
+ case 'arraybuffer':
446
+ return function(val) {
447
+ let res = new val.constructor(val.byteLength);
448
+ return new Uint8Array(res).set(new Uint8Array(val)), res;
449
+ }(val);
450
+ case 'float32array':
451
+ case 'float64array':
452
+ case 'int16array':
453
+ case 'int32array':
454
+ case 'int8array':
455
+ case 'uint16array':
456
+ case 'uint32array':
457
+ case 'uint8clampedarray':
458
+ case 'uint8array':
459
+ return new (val2 = val).constructor(val2.buffer, val2.byteOffset, val2.length);
460
+ case 'regexp':
461
+ return function(val) {
462
+ let flags = void 0 !== val.flags ? val.flags : /\w+$/.exec(val) || void 0, re = new val.constructor(val.source, flags);
463
+ return re.lastIndex = val.lastIndex, re;
464
+ }(val);
465
+ case 'error':
466
+ return Object.create(val);
467
+ default:
468
+ return val;
469
+ }
470
+ };
471
+ },
472
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
473
+ var __read = this && this.__read || function(o, n) {
474
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
475
+ if (!m) return o;
476
+ var r, e, i = m.call(o), ar = [];
477
+ try {
478
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
479
+ } catch (error) {
480
+ e = {
481
+ error: error
482
+ };
483
+ } finally{
484
+ try {
485
+ r && !r.done && (m = i.return) && m.call(i);
486
+ } finally{
487
+ if (e) throw e.error;
488
+ }
489
+ }
490
+ return ar;
491
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
492
+ 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]);
493
+ return to.concat(ar || Array.prototype.slice.call(from));
494
+ }, __importDefault = this && this.__importDefault || function(mod) {
495
+ return mod && mod.__esModule ? mod : {
496
+ default: mod
497
+ };
498
+ };
499
+ Object.defineProperty(exports, "__esModule", {
500
+ value: !0
501
+ }), exports.unique = exports.mergeWithRules = exports.mergeWithCustomize = exports.default = exports.merge = exports.CustomizeRule = exports.customizeObject = exports.customizeArray = void 0;
502
+ 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"));
503
+ exports.unique = unique_1.default;
504
+ var types_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js");
505
+ Object.defineProperty(exports, "CustomizeRule", {
506
+ enumerable: !0,
507
+ get: function() {
508
+ return types_1.CustomizeRule;
509
+ }
510
+ });
511
+ var utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js");
512
+ function merge(firstConfiguration) {
513
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
514
+ return mergeWithCustomize({}).apply(void 0, __spreadArray([
515
+ firstConfiguration
516
+ ], __read(configurations), !1));
517
+ }
518
+ function mergeWithCustomize(options) {
519
+ return function(firstConfiguration) {
520
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
521
+ if ((0, utils_1.isUndefined)(firstConfiguration) || configurations.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
522
+ if (firstConfiguration.then) throw TypeError("Promises are not supported");
523
+ if (!firstConfiguration) return {};
524
+ if (0 === configurations.length) {
525
+ if (Array.isArray(firstConfiguration)) {
526
+ if (0 === firstConfiguration.length) return {};
527
+ if (firstConfiguration.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
528
+ if (firstConfiguration[0].then) throw TypeError("Promises are not supported");
529
+ return (0, merge_with_1.default)(firstConfiguration, (0, join_arrays_1.default)(options));
530
+ }
531
+ return firstConfiguration;
532
+ }
533
+ return (0, merge_with_1.default)([
534
+ firstConfiguration
535
+ ].concat(configurations), (0, join_arrays_1.default)(options));
536
+ };
537
+ }
538
+ exports.merge = merge, exports.default = merge, exports.mergeWithCustomize = mergeWithCustomize, exports.customizeArray = function(rules) {
539
+ return function(a, b, key) {
540
+ var matchedRule = Object.keys(rules).find(function(rule) {
541
+ return (0, wildcard_1.default)(rule, key);
542
+ }) || "";
543
+ if (matchedRule) switch(rules[matchedRule]){
544
+ case types_1.CustomizeRule.Prepend:
545
+ return __spreadArray(__spreadArray([], __read(b), !1), __read(a), !1);
546
+ case types_1.CustomizeRule.Replace:
547
+ return b;
548
+ case types_1.CustomizeRule.Append:
549
+ default:
550
+ return __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
551
+ }
552
+ };
553
+ }, exports.mergeWithRules = function(rules) {
554
+ return mergeWithCustomize({
555
+ customizeArray: function(a, b, key) {
556
+ var currentRule = rules;
557
+ return (key.split(".").forEach(function(k) {
558
+ currentRule && (currentRule = currentRule[k]);
559
+ }), (0, utils_1.isPlainObject)(currentRule)) ? function mergeWithRule(_a) {
560
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
561
+ if (!isArray(a)) return a;
562
+ var bAllMatches = [];
563
+ return a.map(function(ao) {
564
+ if (!(0, utils_1.isPlainObject)(currentRule)) return ao;
565
+ var ret = {}, rulesToMatch = [], operations = {};
566
+ Object.entries(currentRule).forEach(function(_a) {
567
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
568
+ v === types_1.CustomizeRule.Match ? rulesToMatch.push(k) : operations[k] = v;
569
+ });
570
+ var bMatches = b.filter(function(o) {
571
+ var matches = rulesToMatch.every(function(rule) {
572
+ return (0, utils_1.isSameCondition)(ao[rule], o[rule]);
573
+ });
574
+ return matches && bAllMatches.push(o), matches;
575
+ });
576
+ return (0, utils_1.isPlainObject)(ao) ? (Object.entries(ao).forEach(function(_a) {
577
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
578
+ switch(currentRule[k]){
579
+ case types_1.CustomizeRule.Match:
580
+ ret[k] = v, Object.entries(currentRule).forEach(function(_a) {
581
+ var _b = __read(_a, 2), k = _b[0];
582
+ if (_b[1] === types_1.CustomizeRule.Replace && bMatches.length > 0) {
583
+ var val = last(bMatches)[k];
584
+ void 0 !== val && (ret[k] = val);
585
+ }
586
+ });
587
+ break;
588
+ case types_1.CustomizeRule.Append:
589
+ if (!bMatches.length) {
590
+ ret[k] = v;
591
+ break;
592
+ }
593
+ var appendValue = last(bMatches)[k];
594
+ if (!isArray(v) || !isArray(appendValue)) throw TypeError("Trying to append non-arrays");
595
+ ret[k] = v.concat(appendValue);
596
+ break;
597
+ case types_1.CustomizeRule.Merge:
598
+ if (!bMatches.length) {
599
+ ret[k] = v;
600
+ break;
601
+ }
602
+ var lastValue = last(bMatches)[k];
603
+ if (!(0, utils_1.isPlainObject)(v) || !(0, utils_1.isPlainObject)(lastValue)) throw TypeError("Trying to merge non-objects");
604
+ ret[k] = merge(v, lastValue);
605
+ break;
606
+ case types_1.CustomizeRule.Prepend:
607
+ if (!bMatches.length) {
608
+ ret[k] = v;
609
+ break;
610
+ }
611
+ var prependValue = last(bMatches)[k];
612
+ if (!isArray(v) || !isArray(prependValue)) throw TypeError("Trying to prepend non-arrays");
613
+ ret[k] = prependValue.concat(v);
614
+ break;
615
+ case types_1.CustomizeRule.Replace:
616
+ ret[k] = bMatches.length > 0 ? last(bMatches)[k] : v;
617
+ break;
618
+ default:
619
+ var currentRule_1 = operations[k], b_1 = bMatches.map(function(o) {
620
+ return o[k];
621
+ }).reduce(function(acc, val) {
622
+ return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc), !1), __read(val), !1) : acc;
623
+ }, []);
624
+ ret[k] = mergeWithRule({
625
+ currentRule: currentRule_1,
626
+ a: v,
627
+ b: b_1
628
+ });
629
+ }
630
+ }), ret) : ao;
631
+ }).concat(b.filter(function(o) {
632
+ return !bAllMatches.includes(o);
633
+ }));
634
+ }({
635
+ currentRule: currentRule,
636
+ a: a,
637
+ b: b
638
+ }) : "string" == typeof currentRule ? function(_a) {
639
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
640
+ switch(currentRule){
641
+ case types_1.CustomizeRule.Append:
642
+ return a.concat(b);
643
+ case types_1.CustomizeRule.Prepend:
644
+ return b.concat(a);
645
+ case types_1.CustomizeRule.Replace:
646
+ return b;
647
+ }
648
+ return a;
649
+ }({
650
+ currentRule: currentRule,
651
+ a: a,
652
+ b: b
653
+ }) : void 0;
654
+ }
655
+ });
656
+ };
657
+ var isArray = Array.isArray;
658
+ function last(arr) {
659
+ return arr[arr.length - 1];
660
+ }
661
+ exports.customizeObject = function(rules) {
662
+ return function(a, b, key) {
663
+ switch(rules[key]){
664
+ case types_1.CustomizeRule.Prepend:
665
+ return (0, merge_with_1.default)([
666
+ b,
667
+ a
668
+ ], (0, join_arrays_1.default)());
669
+ case types_1.CustomizeRule.Replace:
670
+ return b;
671
+ case types_1.CustomizeRule.Append:
672
+ return (0, merge_with_1.default)([
673
+ a,
674
+ b
675
+ ], (0, join_arrays_1.default)());
676
+ }
677
+ };
678
+ };
679
+ },
680
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js": function(__unused_webpack_module, exports, __webpack_require__) {
681
+ var __read = this && this.__read || function(o, n) {
682
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
683
+ if (!m) return o;
684
+ var r, e, i = m.call(o), ar = [];
685
+ try {
686
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
687
+ } catch (error) {
688
+ e = {
689
+ error: error
690
+ };
691
+ } finally{
692
+ try {
693
+ r && !r.done && (m = i.return) && m.call(i);
694
+ } finally{
695
+ if (e) throw e.error;
696
+ }
697
+ }
698
+ return ar;
699
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
700
+ 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]);
701
+ return to.concat(ar || Array.prototype.slice.call(from));
702
+ }, __importDefault = this && this.__importDefault || function(mod) {
703
+ return mod && mod.__esModule ? mod : {
704
+ default: mod
705
+ };
706
+ };
707
+ Object.defineProperty(exports, "__esModule", {
708
+ value: !0
709
+ });
710
+ 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;
711
+ exports.default = function joinArrays(_a) {
712
+ var _b = void 0 === _a ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
713
+ return function _joinArrays(a, b, k) {
714
+ var newKey = key ? "".concat(key, ".").concat(k) : k;
715
+ if ((0, utils_1.isFunction)(a) && (0, utils_1.isFunction)(b)) return function() {
716
+ for(var args = [], _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i];
717
+ return _joinArrays(a.apply(void 0, __spreadArray([], __read(args), !1)), b.apply(void 0, __spreadArray([], __read(args), !1)), k);
718
+ };
719
+ if (isArray(a) && isArray(b)) {
720
+ var customResult = customizeArray && customizeArray(a, b, newKey);
721
+ return customResult || __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
722
+ }
723
+ if ((0, utils_1.isRegex)(b)) return b;
724
+ if ((0, utils_1.isPlainObject)(a) && (0, utils_1.isPlainObject)(b)) {
725
+ var customResult = customizeObject && customizeObject(a, b, newKey);
726
+ return customResult || (0, merge_with_1.default)([
727
+ a,
728
+ b
729
+ ], joinArrays({
730
+ customizeArray: customizeArray,
731
+ customizeObject: customizeObject,
732
+ key: newKey
733
+ }));
734
+ }
735
+ return (0, utils_1.isPlainObject)(b) ? (0, clone_deep_1.default)(b) : isArray(b) ? __spreadArray([], __read(b), !1) : b;
736
+ };
737
+ };
738
+ },
739
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js": function(__unused_webpack_module, exports) {
740
+ var __read = this && this.__read || function(o, n) {
741
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
742
+ if (!m) return o;
743
+ var r, e, i = m.call(o), ar = [];
744
+ try {
745
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
746
+ } catch (error) {
747
+ e = {
748
+ error: error
749
+ };
750
+ } finally{
751
+ try {
752
+ r && !r.done && (m = i.return) && m.call(i);
753
+ } finally{
754
+ if (e) throw e.error;
755
+ }
756
+ }
757
+ return ar;
758
+ };
759
+ Object.defineProperty(exports, "__esModule", {
760
+ value: !0
761
+ }), exports.default = function(objects, customizer) {
762
+ var _a = __read(objects), first = _a[0], rest = _a.slice(1), ret = first;
763
+ return rest.forEach(function(a) {
764
+ var a1, b, customizer1, ret1;
765
+ a1 = ret, b = a, customizer1 = customizer, ret1 = {}, Object.keys(a1).concat(Object.keys(b)).forEach(function(k) {
766
+ var v = customizer1(a1[k], b[k], k);
767
+ ret1[k] = void 0 === v ? a1[k] : v;
768
+ }), ret = ret1;
769
+ }), ret;
770
+ };
771
+ },
772
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js": function(__unused_webpack_module, exports) {
773
+ var CustomizeRule, CustomizeRule1;
774
+ Object.defineProperty(exports, "__esModule", {
775
+ value: !0
776
+ }), exports.CustomizeRule = void 0, (CustomizeRule1 = CustomizeRule || (exports.CustomizeRule = CustomizeRule = {})).Match = "match", CustomizeRule1.Merge = "merge", CustomizeRule1.Append = "append", CustomizeRule1.Prepend = "prepend", CustomizeRule1.Replace = "replace";
777
+ },
778
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js": function(__unused_webpack_module, exports) {
779
+ var __read = this && this.__read || function(o, n) {
780
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
781
+ if (!m) return o;
782
+ var r, e, i = m.call(o), ar = [];
783
+ try {
784
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
785
+ } catch (error) {
786
+ e = {
787
+ error: error
788
+ };
789
+ } finally{
790
+ try {
791
+ r && !r.done && (m = i.return) && m.call(i);
792
+ } finally{
793
+ if (e) throw e.error;
794
+ }
795
+ }
796
+ return ar;
797
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
798
+ 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]);
799
+ return to.concat(ar || Array.prototype.slice.call(from));
800
+ };
801
+ Object.defineProperty(exports, "__esModule", {
802
+ value: !0
803
+ }), exports.default = function(key, uniques, getter) {
804
+ var uniquesSet = new Set(uniques);
805
+ return function(a, b, k) {
806
+ return k === key && Array.from(__spreadArray(__spreadArray([], __read(a), !1), __read(b), !1).map(function(it) {
807
+ return {
808
+ key: getter(it),
809
+ value: it
810
+ };
811
+ }).map(function(_a) {
812
+ var key = _a.key, value = _a.value;
813
+ return {
814
+ key: uniquesSet.has(key) ? key : value,
815
+ value: value
816
+ };
817
+ }).reduce(function(m, _a) {
818
+ var key = _a.key, value = _a.value;
819
+ return m.delete(key), m.set(key, value);
820
+ }, new Map()).values());
821
+ };
822
+ };
823
+ },
824
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js": function(__unused_webpack_module, exports, __webpack_require__) {
825
+ var __read = this && this.__read || function(o, n) {
826
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
827
+ if (!m) return o;
828
+ var r, e, i = m.call(o), ar = [];
829
+ try {
830
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
831
+ } catch (error) {
832
+ e = {
833
+ error: error
834
+ };
835
+ } finally{
836
+ try {
837
+ r && !r.done && (m = i.return) && m.call(i);
838
+ } finally{
839
+ if (e) throw e.error;
840
+ }
841
+ }
842
+ return ar;
843
+ };
844
+ Object.defineProperty(exports, "__esModule", {
845
+ value: !0
846
+ }), exports.isSameCondition = exports.isUndefined = exports.isPlainObject = exports.isFunction = exports.isRegex = void 0;
847
+ var flat_1 = __webpack_require__("../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js");
848
+ function isRegex(o) {
849
+ return o instanceof RegExp;
850
+ }
851
+ function isFunction(functionToCheck) {
852
+ return functionToCheck && "[object Function]" === ({}).toString.call(functionToCheck);
853
+ }
854
+ exports.isRegex = isRegex, exports.isFunction = isFunction, exports.isPlainObject = function(a) {
855
+ return !(null === a || Array.isArray(a)) && "object" == typeof a;
856
+ }, exports.isUndefined = function(a) {
857
+ return void 0 === a;
858
+ }, exports.isSameCondition = function(a, b) {
859
+ if (!a || !b) return a === b;
860
+ if ("string" == typeof a || "string" == typeof b || isRegex(a) || isRegex(b) || isFunction(a) || isFunction(b)) return a.toString() === b.toString();
861
+ var _a, _b, entriesA = Object.entries((0, flat_1.flatten)(a)), entriesB = Object.entries((0, flat_1.flatten)(b));
862
+ if (entriesA.length !== entriesB.length) return !1;
863
+ 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, "[]");
864
+ function cmp(_a, _b) {
865
+ var _c = __read(_a, 2), k1 = _c[0], v1 = _c[1], _d = __read(_b, 2), k2 = _d[0], v2 = _d[1];
866
+ return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
867
+ }
868
+ if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
869
+ 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;
870
+ return !0;
871
+ };
872
+ },
873
+ "../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js": function(module) {
874
+ var REGEXP_PARTS = /(\*|\?)/g;
875
+ function WildcardMatcher(text, separator) {
876
+ this.text = text = text || '', this.hasWild = text.indexOf('*') >= 0, this.separator = separator, this.parts = text.split(separator).map(this.classifyPart.bind(this));
877
+ }
878
+ WildcardMatcher.prototype.match = function(input) {
879
+ var ii, testParts, matches = !0, parts = this.parts, partsCount = parts.length;
880
+ if ('string' == typeof input || input instanceof String) {
881
+ if (this.hasWild || this.text == input) {
882
+ 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]));
883
+ matches = matches && testParts;
884
+ } else matches = !1;
885
+ } else if ('function' == typeof input.splice) for(matches = [], ii = input.length; ii--;)this.match(input[ii]) && (matches[matches.length] = input[ii]);
886
+ else if ('object' == typeof input) for(var key in matches = {}, input)this.match(key) && (matches[key] = input[key]);
887
+ return matches;
888
+ }, WildcardMatcher.prototype.classifyPart = function(part) {
889
+ if ('*' === part) ;
890
+ else if (part.indexOf('*') >= 0 || part.indexOf('?') >= 0) return new RegExp(part.replace(REGEXP_PARTS, '\.$1'));
891
+ return part;
892
+ }, module.exports = function(text, test, separator) {
893
+ var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
894
+ return void 0 !== test ? matcher.match(test) : matcher;
895
+ };
896
+ },
260
897
  crypto: function(module) {
261
898
  module.exports = __WEBPACK_EXTERNAL_MODULE_crypto__;
262
899
  },
@@ -279,25 +916,19 @@ function __webpack_require__(moduleId) {
279
916
  var module = __webpack_module_cache__[moduleId] = {
280
917
  exports: {}
281
918
  };
282
- return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
919
+ return __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.exports;
283
920
  }
284
- __webpack_require__.n = function(module) {
285
- var getter = module && module.__esModule ? function() {
286
- return module.default;
287
- } : function() {
288
- return module;
289
- };
921
+ __webpack_require__.n = (module)=>{
922
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
290
923
  return __webpack_require__.d(getter, {
291
924
  a: getter
292
925
  }), getter;
293
- }, __webpack_require__.d = function(exports, definition) {
926
+ }, __webpack_require__.d = (exports, definition)=>{
294
927
  for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
295
928
  enumerable: !0,
296
929
  get: definition[key]
297
930
  });
298
- }, __webpack_require__.o = function(obj, prop) {
299
- return Object.prototype.hasOwnProperty.call(obj, prop);
300
- }, __webpack_require__.r = function(exports) {
931
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = function(exports) {
301
932
  'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
302
933
  value: 'Module'
303
934
  }), Object.defineProperty(exports, '__esModule', {
@@ -778,7 +1409,7 @@ function parsePackageOrReadConfig(file) {
778
1409
  }
779
1410
  function pickEnv(config, opts) {
780
1411
  let name;
781
- 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);
1412
+ 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;
782
1413
  }
783
1414
  function eachParent(file, callback) {
784
1415
  let dir = isFile(file) ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.dirname(file) : file, loc = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.resolve(dir);
@@ -803,7 +1434,7 @@ let configCache = {}, OVERRIDE_PATHS = [
803
1434
  return OVERRIDE_PATHS.includes(realKey);
804
1435
  }
805
1436
  return OVERRIDE_PATHS.includes(key);
806
- }, mergeConfig_merge = (x, y, path = '')=>{
1437
+ }, merge = (x, y, path = '')=>{
807
1438
  if (isOverridePath(path)) return y ?? x;
808
1439
  if (void 0 === x) return isPlainObject(y) ? cloneDeep(y) : y;
809
1440
  if (void 0 === y) return isPlainObject(x) ? cloneDeep(x) : x;
@@ -824,10 +1455,10 @@ let configCache = {}, OVERRIDE_PATHS = [
824
1455
  ...Object.keys(y)
825
1456
  ])){
826
1457
  let childPath = path ? `${path}.${key}` : key;
827
- merged[key] = mergeConfig_merge(x[key], y[key], childPath);
1458
+ merged[key] = merge(x[key], y[key], childPath);
828
1459
  }
829
1460
  return merged;
830
- }, 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 ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(cwd, envDir) : cwd;
1461
+ }, 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 ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(cwd, envDir) : cwd;
831
1462
  async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
832
1463
  cliOptions && (commonOpts = cliOptions);
833
1464
  try {
@@ -1148,7 +1779,7 @@ async function watchFilesForRestart(files, root, isBuildWatch, watchOptions) {
1148
1779
  ignorePermissionErrors: !0,
1149
1780
  ...watchOptions
1150
1781
  }), callback = (func = async (filePath)=>{
1151
- watcher.close(), isBuildWatch ? await restartBuild({
1782
+ await watcher.close(), isBuildWatch ? await restartBuild({
1152
1783
  filePath
1153
1784
  }) : await restartDevServer({
1154
1785
  filePath
@@ -1653,7 +2284,7 @@ async function updateEnvironmentContext(context, configs) {
1653
2284
  async function createContext(options, userConfig, bundlerType) {
1654
2285
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
1655
2286
  return {
1656
- version: "1.2.15",
2287
+ version: "1.2.17",
1657
2288
  rootPath,
1658
2289
  distPath: '',
1659
2290
  cachePath,
@@ -2280,9 +2911,26 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
2280
2911
  localIdentName,
2281
2912
  emitCss
2282
2913
  });
2283
- rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions), rule.merge({
2914
+ rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions);
2915
+ let isStringExport = 'string' === cssLoaderOptions.exportType;
2916
+ if (isStringExport && rule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && rule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), rule.merge({
2284
2917
  sideEffects: !0
2285
- }), rule.resolve.preferRelative(!0);
2918
+ }), rule.resolve.preferRelative(!0), emitCss && !config.output.injectStyles && !isStringExport) {
2919
+ 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');
2920
+ chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
2921
+ {
2922
+ filename: isCssFilenameFn ? (...args)=>{
2923
+ let name = cssFilename(...args);
2924
+ return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, name);
2925
+ } : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, cssFilename),
2926
+ chunkFilename: isCssFilenameFn ? (...args)=>{
2927
+ let name = cssFilename(...args);
2928
+ return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, name);
2929
+ } : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, cssFilename),
2930
+ ...extractPluginOptions
2931
+ }
2932
+ ]);
2933
+ }
2286
2934
  }
2287
2935
  });
2288
2936
  }
@@ -2370,21 +3018,24 @@ async function printFileSizes(options, stats, rootPath, environmentName) {
2370
3018
  if (0 === assets.length) return logs;
2371
3019
  logs.push(''), assets.sort((a, b)=>a.size - b.size);
2372
3020
  let longestLabelLength = Math.max(...assets.map((a)=>a.sizeLabel.length)), longestFileLength = Math.max(...assets.map((a)=>(a.folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + a.name).length));
2373
- !1 !== options.detail && logs.push(function(longestFileLength, longestLabelLength, options, environmentName) {
2374
- let longestLengths = [
2375
- longestFileLength,
2376
- longestLabelLength
2377
- ], rowTypes = [
2378
- `File (${environmentName})`,
2379
- 'Size'
2380
- ];
2381
- options.compressed && rowTypes.push('Gzip');
2382
- let headerRow = rowTypes.reduce((prev, cur, index)=>{
2383
- let length = longestLengths[index], curLabel = cur;
2384
- return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
2385
- }, ' ');
2386
- return __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.blue(headerRow);
2387
- }(longestFileLength, longestLabelLength, options, environmentName));
3021
+ if (!1 !== options.detail) {
3022
+ let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
3023
+ logs.push(function(longestFileLength, longestLabelLength, environmentName, showGzipHeader) {
3024
+ let longestLengths = [
3025
+ longestFileLength,
3026
+ longestLabelLength
3027
+ ], rowTypes = [
3028
+ `File (${environmentName})`,
3029
+ 'Size'
3030
+ ];
3031
+ showGzipHeader && rowTypes.push('Gzip');
3032
+ let headerRow = rowTypes.reduce((prev, cur, index)=>{
3033
+ let length = longestLengths[index], curLabel = cur;
3034
+ return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
3035
+ }, ' ');
3036
+ return __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.blue(headerRow);
3037
+ }(longestFileLength, longestLabelLength, environmentName, showGzipHeader));
3038
+ }
2388
3039
  let totalSize = 0, totalGzipSize = 0;
2389
3040
  for (let asset of assets){
2390
3041
  let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + name).length, sizeLength = sizeLabel.length;
@@ -3111,7 +3762,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3111
3762
  ...headTags,
3112
3763
  ...bodyTags
3113
3764
  ];
3114
- if (nonce) for (let tag of allTags)("script" === tag.tag || 'style' === tag.tag) && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
3765
+ if (nonce) for (let tag of allTags){
3766
+ var _tag_attrs, _tag_attrs1;
3767
+ ("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);
3768
+ }
3115
3769
  return {
3116
3770
  headTags,
3117
3771
  bodyTags
@@ -3341,7 +3995,7 @@ async function open_open({ https, port, routes, config, clearCache }) {
3341
3995
  let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
3342
3996
  name: 'rsbuild:output',
3343
3997
  setup (api) {
3344
- api.modifyBundlerChain(async (chain, { CHAIN_ID, target, isProd, isServer, environment })=>{
3998
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
3345
3999
  let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
3346
4000
  var _context_devServer, _context_devServer1, _context_devServer2;
3347
4001
  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;
@@ -3374,23 +4028,6 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
3374
4028
  options
3375
4029
  ]);
3376
4030
  }
3377
- let emitCss = config.output.emitCss ?? 'web' === target;
3378
- if (!config.output.injectStyles && emitCss) {
3379
- 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');
3380
- chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
3381
- {
3382
- filename: isCssFilenameFn ? (...args)=>{
3383
- let name = cssFilename(...args);
3384
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, name);
3385
- } : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, cssFilename),
3386
- chunkFilename: isCssFilenameFn ? (...args)=>{
3387
- let name = cssFilename(...args);
3388
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, name);
3389
- } : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, cssFilename),
3390
- ...extractPluginOptions
3391
- }
3392
- ]);
3393
- }
3394
4031
  });
3395
4032
  }
3396
4033
  }), pluginPerformance = ()=>({
@@ -3882,7 +4519,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
3882
4519
  };
3883
4520
  'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
3884
4521
  let { chunkSplit } = config.performance, forceSplittingGroups = {};
3885
- chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting) {
4522
+ chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
3886
4523
  let cacheGroups = {};
3887
4524
  for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
3888
4525
  `force-split-${index}`,
@@ -3891,11 +4528,11 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
3891
4528
  test: regexp,
3892
4529
  name: key,
3893
4530
  chunks: 'all',
3894
- priority: 0,
4531
+ priority: +('single-vendor' === strategy),
3895
4532
  enforce: !0
3896
4533
  };
3897
4534
  return cacheGroups;
3898
- }(chunkSplit.forceSplitting));
4535
+ }(chunkSplit.forceSplitting, chunkSplit.strategy));
3899
4536
  let override = 'custom' === chunkSplit.strategy ? chunkSplit.splitChunks ?? chunkSplit.override : chunkSplit.override, splitChunksOptions = await SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy || 'split-by-experience']({
3900
4537
  defaultConfig,
3901
4538
  override: override || {},
@@ -4153,6 +4790,7 @@ async function inspectConfig({ context, pluginManager, rsbuildOptions, bundlerCo
4153
4790
  }
4154
4791
  };
4155
4792
  }
4793
+ var dist = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js");
4156
4794
  async function modifyRspackConfig(context, rspackConfig, utils) {
4157
4795
  var _utils_environment_config_tools;
4158
4796
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify Rspack config');
@@ -4171,11 +4809,10 @@ async function modifyRspackConfig(context, rspackConfig, utils) {
4171
4809
  })), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify Rspack config done'), modifiedConfig;
4172
4810
  }
4173
4811
  async function getConfigUtils(config, chainUtils) {
4174
- let { merge } = await import("../compiled/webpack-merge/index.js");
4175
4812
  return {
4176
4813
  ...chainUtils,
4177
4814
  rspack: __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack,
4178
- mergeConfig: merge,
4815
+ mergeConfig: dist.merge,
4179
4816
  addRules (rules) {
4180
4817
  let ruleArr = castArray(rules);
4181
4818
  config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
@@ -4610,47 +5247,50 @@ class SocketServer {
4610
5247
  let curStats = this.stats[name];
4611
5248
  if (!curStats) return null;
4612
5249
  let statsOptions = getStatsOptions(curStats.compilation.compiler);
4613
- return curStats.toJson({
4614
- all: !1,
4615
- hash: !0,
4616
- assets: !0,
4617
- warnings: !0,
4618
- warningsCount: !0,
4619
- errors: !0,
4620
- errorsCount: !0,
4621
- errorDetails: !1,
4622
- entrypoints: !0,
4623
- children: !0,
4624
- moduleTrace: !0,
4625
- ...statsOptions
4626
- });
5250
+ return {
5251
+ statsJson: curStats.toJson({
5252
+ all: !1,
5253
+ hash: !0,
5254
+ assets: !0,
5255
+ warnings: !0,
5256
+ warningsCount: !0,
5257
+ errors: !0,
5258
+ errorsCount: !0,
5259
+ errorDetails: !1,
5260
+ entrypoints: !0,
5261
+ children: !0,
5262
+ moduleTrace: !0,
5263
+ ...statsOptions
5264
+ }),
5265
+ root: curStats.compilation.compiler.options.context
5266
+ };
4627
5267
  }
4628
5268
  sendStats({ force = !1, compilationId }) {
4629
- let stats = this.getStats(compilationId);
4630
- if (!stats) return null;
4631
- let newInitialChunks = new Set();
4632
- if (stats.entrypoints) for (let entrypoint of Object.values(stats.entrypoints)){
5269
+ let result = this.getStats(compilationId);
5270
+ if (!result) return null;
5271
+ let { statsJson, root } = result, newInitialChunks = new Set();
5272
+ if (statsJson.entrypoints) for (let entrypoint of Object.values(statsJson.entrypoints)){
4633
5273
  let chunks = entrypoint.chunks;
4634
5274
  if (Array.isArray(chunks)) for (let chunkName of chunks)chunkName && newInitialChunks.add(String(chunkName));
4635
5275
  }
4636
- let initialChunks = this.initialChunks[compilationId], shouldReload = !!stats.entrypoints && !!initialChunks && !(initialChunks.size === newInitialChunks.size && [
5276
+ let initialChunks = this.initialChunks[compilationId], shouldReload = !!statsJson.entrypoints && !!initialChunks && !(initialChunks.size === newInitialChunks.size && [
4637
5277
  ...initialChunks
4638
5278
  ].every((value)=>newInitialChunks.has(value)));
4639
5279
  if (this.initialChunks[compilationId] = newInitialChunks, shouldReload) return this.sockWrite({
4640
5280
  type: 'static-changed',
4641
5281
  compilationId
4642
5282
  });
4643
- if (!force && stats && !stats.errorsCount && stats.assets && stats.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
5283
+ if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
4644
5284
  type: 'still-ok',
4645
5285
  compilationId
4646
5286
  });
4647
5287
  if (this.sockWrite({
4648
5288
  type: 'hash',
4649
5289
  compilationId,
4650
- data: stats.hash
4651
- }), stats.errorsCount) {
5290
+ data: statsJson.hash
5291
+ }), statsJson.errorsCount) {
4652
5292
  let { errors: formattedErrors } = formatStatsMessages({
4653
- errors: getAllStatsErrors(stats),
5293
+ errors: getAllStatsErrors(statsJson),
4654
5294
  warnings: []
4655
5295
  });
4656
5296
  return this.sockWrite({
@@ -4658,10 +5298,13 @@ class SocketServer {
4658
5298
  compilationId,
4659
5299
  data: {
4660
5300
  text: formattedErrors,
4661
- html: function(errors) {
4662
- 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)=>{
4663
- let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file;
4664
- return `<a class="file-link" data-file="${filePath}">${filePath}</a>${hasClosingSpan ? '</span>' : ''}`;
5301
+ html: function(errors, root) {
5302
+ 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)=>{
5303
+ let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(filePath), absolutePath = root && !isAbsolute ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(root, filePath) : filePath, relativePath = root && isAbsolute ? function(base, filepath) {
5304
+ let relativePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.relative)(base, filepath);
5305
+ return '' === relativePath ? `.${__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep}` : relativePath.startsWith('.') ? relativePath : `.${__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep}${relativePath}`;
5306
+ }(root, filePath) : filePath;
5307
+ return `<a class="file-link" data-file="${absolutePath}">${relativePath}</a>${hasClosingSpan ? '</span>' : ''}`;
4665
5308
  }));
4666
5309
  return `
4667
5310
  <style>
@@ -4783,13 +5426,13 @@ class SocketServer {
4783
5426
  </div>
4784
5427
  </div>
4785
5428
  `;
4786
- }(formattedErrors)
5429
+ }(formattedErrors, root)
4787
5430
  }
4788
5431
  });
4789
5432
  }
4790
- if (stats.warningsCount) {
5433
+ if (statsJson.warningsCount) {
4791
5434
  let { warnings: formattedWarnings } = formatStatsMessages({
4792
- warnings: getAllStatsWarnings(stats),
5435
+ warnings: getAllStatsWarnings(statsJson),
4793
5436
  errors: []
4794
5437
  });
4795
5438
  return this.sockWrite({
@@ -5619,11 +6262,21 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
5619
6262
  })).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
5620
6263
  return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create dev server done'), devServerAPI;
5621
6264
  }
5622
- function cutPath(filePath, root) {
5623
- let prefix = root.endsWith(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) ? root : root + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep;
5624
- if (filePath.startsWith(prefix)) return filePath.slice(prefix.length);
5625
- let parts = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).filter(Boolean);
5626
- return parts.length > 3 ? parts.slice(-3).join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) : parts.join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep);
6265
+ function isLikelyFile(filePath) {
6266
+ return (filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).pop() || '').includes('.');
6267
+ }
6268
+ function formatFileList(paths, rootPath) {
6269
+ let files = paths.filter(isLikelyFile);
6270
+ 0 === files.length && (files = [
6271
+ paths[0]
6272
+ ]);
6273
+ let fileInfo = files.slice(0, 1).map((file)=>(function(originalFilePath, root) {
6274
+ let prefix = root.endsWith(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) ? root : root + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep, filePath = originalFilePath;
6275
+ filePath.startsWith(prefix) && (filePath = filePath.slice(prefix.length));
6276
+ let parts = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).filter(Boolean);
6277
+ return parts.length > 3 ? parts.slice(-3).join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) : parts.join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep);
6278
+ })(file, rootPath)).join(', ');
6279
+ return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
5627
6280
  }
5628
6281
  async function createCompiler_createCompiler(options) {
5629
6282
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create compiler');
@@ -5636,17 +6289,21 @@ async function createCompiler_createCompiler(options) {
5636
6289
  isVersionLogged || (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`use Rspack v${__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.rspackVersion}`), isVersionLogged = !0);
5637
6290
  };
5638
6291
  compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
5639
- if (logRspackVersion(), !isCompiling) {
5640
- let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : [], removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : [];
5641
- if (changedFiles.length) {
5642
- let fileInfo = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(changedFiles.map((file)=>cutPath(file, context.rootPath)).join(', '));
5643
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${fileInfo}`);
5644
- } else if (removedFiles.length) {
5645
- let fileInfo = removedFiles.map((file)=>cutPath(file, context.rootPath)).join(', ');
6292
+ logRspackVersion(), isCompiling || function(compiler, context) {
6293
+ let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
6294
+ if (null == changedFiles ? void 0 : changedFiles.length) {
6295
+ let fileInfo = formatFileList(changedFiles, context.rootPath);
6296
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(fileInfo)}`);
6297
+ return;
6298
+ }
6299
+ let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
6300
+ if (null == removedFiles ? void 0 : removedFiles.length) {
6301
+ let fileInfo = formatFileList(removedFiles, context.rootPath);
5646
6302
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(`removed ${fileInfo}`)}`);
5647
- } else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
5648
- }
5649
- isCompiling = !0;
6303
+ return;
6304
+ }
6305
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
6306
+ }(compiler, context), isCompiling = !0;
5650
6307
  }), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
5651
6308
  let done = (stats)=>{
5652
6309
  let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
@@ -6624,7 +7281,7 @@ class CAC extends __WEBPACK_EXTERNAL_MODULE_events__.EventEmitter {
6624
7281
  }), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
6625
7282
  }
6626
7283
  }
6627
- let dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
7284
+ let cac_dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
6628
7285
  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`', {
6629
7286
  default: 'jiti'
6630
7287
  }).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', {
@@ -6648,12 +7305,12 @@ async function runCLI() {
6648
7305
  }
6649
7306
  }(), process.title = 'rsbuild-node';
6650
7307
  let { npm_execpath } = process.env;
6651
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.15\n`);
7308
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.17\n`);
6652
7309
  }();
6653
7310
  try {
6654
7311
  !function() {
6655
- let cli = dist('rsbuild');
6656
- cli.help(), cli.version("1.2.15"), applyCommonOptions(cli);
7312
+ let cli = cac_dist('rsbuild');
7313
+ cli.help(), cli.version("1.2.17"), applyCommonOptions(cli);
6657
7314
  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');
6658
7315
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
6659
7316
  try {
@@ -6704,6 +7361,6 @@ async function runCLI() {
6704
7361
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
6705
7362
  }
6706
7363
  }
6707
- let src_version = "1.2.15";
7364
+ let src_version = "1.2.17";
6708
7365
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
6709
7366
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };