@rsbuild/core 2.3.3 → 2.3.5
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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +2 -0
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss-loader/index.js +160 -38
- package/compiled/postcss-loader/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +3 -0
- package/dist/client/hmr.js +19 -8
- package/dist/http-proxy-middleware.js +8 -4
- package/dist/index.d.ts +1 -1
- package/dist/m.js +234 -121
- package/dist/manifest-plugin.js +1 -1
- package/dist/range-parser.js +86 -48
- package/dist/rslib-runtime.js +9 -6
- package/dist/server/buildManager.d.ts +3 -2
- package/dist/server/devServer.d.ts +2 -0
- package/dist/server/socketServer.d.ts +9 -2
- package/dist/types/config.d.ts +7 -2
- package/package.json +8 -12
- package/types.d.ts +9 -0
package/dist/m.js
CHANGED
|
@@ -292,8 +292,8 @@ moduleFactories.add({
|
|
|
292
292
|
};
|
|
293
293
|
};
|
|
294
294
|
},
|
|
295
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
296
|
-
let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
295
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/index.js" (module) {
|
|
296
|
+
let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/req.js");
|
|
297
297
|
async function processResult(ctx, result) {
|
|
298
298
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
299
299
|
default: obj
|
|
@@ -366,8 +366,8 @@ moduleFactories.add({
|
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
368
|
},
|
|
369
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
370
|
-
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
369
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/options.js" (module) {
|
|
370
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/req.js");
|
|
371
371
|
module.exports = async function options(config, file) {
|
|
372
372
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
373
373
|
config.parser = await req(config.parser, file);
|
|
@@ -387,8 +387,8 @@ moduleFactories.add({
|
|
|
387
387
|
return config;
|
|
388
388
|
};
|
|
389
389
|
},
|
|
390
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
391
|
-
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
390
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/plugins.js" (module) {
|
|
391
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/req.js");
|
|
392
392
|
async function load(plugin, options, file) {
|
|
393
393
|
try {
|
|
394
394
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -404,7 +404,7 @@ moduleFactories.add({
|
|
|
404
404
|
}), list;
|
|
405
405
|
};
|
|
406
406
|
},
|
|
407
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
407
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/req.js" (module) {
|
|
408
408
|
let tsx, jiti, { createRequire } = __rspack_createRequire_require("node:module"), { pathToFileURL } = __rspack_createRequire_require("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
409
409
|
module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
|
|
410
410
|
let url = createRequire(rootFile).resolve(name);
|
|
@@ -552,58 +552,9 @@ isDebug() && (src_logger.level = 'verbose'), applyDebugOverride(src_logger);
|
|
|
552
552
|
let logger_createLogger = (...args)=>{
|
|
553
553
|
let instance = createLogger(...args);
|
|
554
554
|
return isDebug() && args[0]?.level === void 0 && (instance.level = 'verbose'), applyDebugOverride(instance), instance;
|
|
555
|
-
}
|
|
556
|
-
function toArr(any) {
|
|
557
|
-
return null == any ? [] : Array.isArray(any) ? any : [
|
|
558
|
-
any
|
|
559
|
-
];
|
|
560
|
-
}
|
|
561
|
-
function toVal(out, key, val, opts) {
|
|
562
|
-
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || !0 === val ? "" : String(val) : "boolean" == typeof val ? val : ~opts.boolean.indexOf(key) ? "false" !== val && ("true" === val || (out._.push(0 * (x = +val) == 0 ? x : val), !!val)) : 0 * (x = +val) == 0 ? x : val;
|
|
563
|
-
out[key] = null == old ? nxt : Array.isArray(old) ? old.concat(nxt) : [
|
|
564
|
-
old,
|
|
565
|
-
nxt
|
|
566
|
-
];
|
|
567
|
-
}
|
|
568
|
-
function lib_default(args, opts) {
|
|
569
|
-
opts = opts || {};
|
|
570
|
-
var k, arr, arg, name, val, out = {
|
|
571
|
-
_: []
|
|
572
|
-
}, i = 0, j = 0, idx = 0, len = (args = args || []).length;
|
|
573
|
-
let alibi = void 0 !== opts.alias, strict = void 0 !== opts.unknown, defaults = void 0 !== opts.default;
|
|
574
|
-
if (opts.alias = opts.alias || {}, opts.string = toArr(opts.string), opts.boolean = toArr(opts.boolean), alibi) for(k in opts.alias)for(arr = opts.alias[k] = toArr(opts.alias[k]), i = 0; i < arr.length; i++)(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
575
|
-
for(i = opts.boolean.length; i-- > 0;)for(j = (arr = opts.alias[opts.boolean[i]] || []).length; j-- > 0;)opts.boolean.push(arr[j]);
|
|
576
|
-
for(i = opts.string.length; i-- > 0;)for(j = (arr = opts.alias[opts.string[i]] || []).length; j-- > 0;)opts.string.push(arr[j]);
|
|
577
|
-
if (defaults) {
|
|
578
|
-
for(k in opts.default)if (name = typeof opts.default[k], arr = opts.alias[k] = opts.alias[k] || [], void 0 !== opts[name]) for(opts[name].push(k), i = 0; i < arr.length; i++)opts[name].push(arr[i]);
|
|
579
|
-
}
|
|
580
|
-
let keys = strict ? Object.keys(opts.alias) : [];
|
|
581
|
-
for(i = 0; i < len; i++){
|
|
582
|
-
if ("--" === (arg = args[i])) {
|
|
583
|
-
out._ = out._.concat(args.slice(++i));
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
for(j = 0; j < arg.length && 45 === arg.charCodeAt(j); j++);
|
|
587
|
-
if (0 === j) out._.push(arg);
|
|
588
|
-
else if ("no-" === arg.substring(j, j + 3)) {
|
|
589
|
-
if (name = arg.substring(j + 3), strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
590
|
-
out[name] = !1;
|
|
591
|
-
} else {
|
|
592
|
-
for(idx = j + 1; idx < arg.length && 61 !== arg.charCodeAt(idx); idx++);
|
|
593
|
-
for(name = arg.substring(j, idx), val = arg.substring(++idx) || i + 1 === len || 45 === ("" + args[i + 1]).charCodeAt(0) || args[++i], arr = 2 === j ? [
|
|
594
|
-
name
|
|
595
|
-
] : name, idx = 0; idx < arr.length; idx++){
|
|
596
|
-
if (name = arr[idx], strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
597
|
-
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
if (defaults) for(k in opts.default)void 0 === out[k] && (out[k] = opts.default[k]);
|
|
602
|
-
if (alibi) for(k in out)for(arr = opts.alias[k] || []; arr.length > 0;)out[arr.shift()] = out[k];
|
|
603
|
-
return out;
|
|
604
|
-
}
|
|
555
|
+
}, BRACKETS_AND_REST_RE = /[<[].+/, FILE_NAME_RE = /([^\\/]+)$/;
|
|
605
556
|
function removeBrackets(v) {
|
|
606
|
-
return v.replace(
|
|
557
|
+
return v.replace(BRACKETS_AND_REST_RE, "").trim();
|
|
607
558
|
}
|
|
608
559
|
function findAllBrackets(v) {
|
|
609
560
|
let angledMatch, squareMatch, ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g, SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g, res = [], parse = (match)=>{
|
|
@@ -649,7 +600,7 @@ function setDotProp(obj, keys, val) {
|
|
|
649
600
|
current[key] = val;
|
|
650
601
|
return;
|
|
651
602
|
}
|
|
652
|
-
if (null == current[key]) {
|
|
603
|
+
if (!Object.hasOwn(current, key) || null == current[key]) {
|
|
653
604
|
let nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
654
605
|
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
655
606
|
}
|
|
@@ -662,7 +613,7 @@ function setByType(obj, transforms) {
|
|
|
662
613
|
].flat(), "function" == typeof transform.transformFunction && (obj[key] = obj[key].map(transform.transformFunction)));
|
|
663
614
|
}
|
|
664
615
|
function getFileName(input) {
|
|
665
|
-
let m =
|
|
616
|
+
let m = FILE_NAME_RE.exec(input);
|
|
666
617
|
return m ? m[1] : "";
|
|
667
618
|
}
|
|
668
619
|
function camelcaseOptionName(name) {
|
|
@@ -672,7 +623,9 @@ var CACError = class extends Error {
|
|
|
672
623
|
constructor(message){
|
|
673
624
|
super(message), this.name = "CACError", "function" != typeof Error.captureStackTrace && (this.stack = Error(message).stack);
|
|
674
625
|
}
|
|
675
|
-
}
|
|
626
|
+
};
|
|
627
|
+
let LEADING_DASHES_RE = /^-{1,2}/, NEGATED_PREFIX_RE = /^no-/;
|
|
628
|
+
var Option = class {
|
|
676
629
|
rawName;
|
|
677
630
|
description;
|
|
678
631
|
name;
|
|
@@ -683,8 +636,8 @@ var CACError = class extends Error {
|
|
|
683
636
|
negated;
|
|
684
637
|
constructor(rawName, description, config){
|
|
685
638
|
this.rawName = rawName, this.description = description, this.config = Object.assign({}, config), rawName = rawName.replaceAll(".*", ""), this.negated = !1, this.names = removeBrackets(rawName).split(",").map((v)=>{
|
|
686
|
-
let name = v.trim().replace(
|
|
687
|
-
return name.startsWith("no-") && (this.negated = !0, name = name.replace(
|
|
639
|
+
let name = v.trim().replace(LEADING_DASHES_RE, "");
|
|
640
|
+
return name.startsWith("no-") && (this.negated = !0, name = name.replace(NEGATED_PREFIX_RE, "")), camelcaseOptionName(name);
|
|
688
641
|
}).sort((a, b)=>a.length - b.length), this.name = this.names.at(-1), this.negated && null == this.config.default && (this.config.default = !0), rawName.includes("<") ? this.required = !0 : rawName.includes("[") ? this.required = !1 : this.isBoolean = !0;
|
|
689
642
|
}
|
|
690
643
|
};
|
|
@@ -813,14 +766,75 @@ var Command = class {
|
|
|
813
766
|
}
|
|
814
767
|
}
|
|
815
768
|
checkUnusedArgs() {
|
|
816
|
-
let maximumArgsCount = this.args.some((arg)=>arg.variadic) ?
|
|
769
|
+
let maximumArgsCount = this.args.some((arg)=>arg.variadic) ? 1e400 : this.args.length;
|
|
817
770
|
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg)=>`\`${arg}\``).join(", ")}`);
|
|
818
771
|
}
|
|
819
772
|
}, GlobalCommand = class extends Command {
|
|
820
773
|
constructor(cli){
|
|
821
774
|
super("@@global@@", "", {}, cli);
|
|
822
775
|
}
|
|
823
|
-
}
|
|
776
|
+
};
|
|
777
|
+
function isNumeric(val) {
|
|
778
|
+
return Number.isFinite(+val);
|
|
779
|
+
}
|
|
780
|
+
function toVal(out, key, val, booleans) {
|
|
781
|
+
let next;
|
|
782
|
+
"boolean" == typeof val ? next = val : booleans.includes(key) ? "false" === val ? next = !1 : "true" === val ? next = !0 : (out._.push(isNumeric(val) ? +val : val), next = !!val) : next = isNumeric(val) ? +val : val;
|
|
783
|
+
let old = out[key];
|
|
784
|
+
out[key] = null == old ? next : Array.isArray(old) ? old.concat(next) : [
|
|
785
|
+
old,
|
|
786
|
+
next
|
|
787
|
+
];
|
|
788
|
+
}
|
|
789
|
+
function mri(args, opts) {
|
|
790
|
+
let out = Object.create(null);
|
|
791
|
+
out._ = [];
|
|
792
|
+
let aliases = Object.create(null);
|
|
793
|
+
for (let name of (Object.assign(aliases, opts.alias), Object.keys(aliases))){
|
|
794
|
+
let list = aliases[name];
|
|
795
|
+
for (let [i, alias] of list.entries())aliases[alias] = [
|
|
796
|
+
...list.slice(0, i),
|
|
797
|
+
...list.slice(i + 1),
|
|
798
|
+
name
|
|
799
|
+
];
|
|
800
|
+
}
|
|
801
|
+
let booleans = [
|
|
802
|
+
...opts.boolean
|
|
803
|
+
];
|
|
804
|
+
for (let name of opts.boolean){
|
|
805
|
+
let list = aliases[name];
|
|
806
|
+
list && booleans.push(...list);
|
|
807
|
+
}
|
|
808
|
+
for(let i = 0; i < args.length; i++){
|
|
809
|
+
let arg = args[i];
|
|
810
|
+
if ("--" === arg) {
|
|
811
|
+
out._ = out._.concat(args.slice(i + 1));
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
let dashes = 0;
|
|
815
|
+
for(; "-" === arg[dashes];)dashes++;
|
|
816
|
+
if (0 === dashes) {
|
|
817
|
+
out._.push(arg);
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
820
|
+
if ("no-" === arg.slice(dashes, dashes + 3)) {
|
|
821
|
+
out[arg.slice(dashes + 3)] = !1;
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
let eq = dashes + 1;
|
|
825
|
+
for(; eq < arg.length && "=" !== arg[eq];)eq++;
|
|
826
|
+
let name = arg.slice(dashes, eq), val = arg.slice(eq + 1) || i + 1 === args.length || String(args[i + 1]).startsWith("-") || args[++i], names = 2 === dashes ? [
|
|
827
|
+
name
|
|
828
|
+
] : name.split("");
|
|
829
|
+
for (let [idx, flag] of names.entries())toVal(out, flag, idx + 1 < names.length || val, booleans);
|
|
830
|
+
}
|
|
831
|
+
for (let key of Object.keys(out)){
|
|
832
|
+
let list = aliases[key];
|
|
833
|
+
if (list) for (let alias of list)out[alias] = out[key];
|
|
834
|
+
}
|
|
835
|
+
return out;
|
|
836
|
+
}
|
|
837
|
+
var CAC = class extends EventTarget {
|
|
824
838
|
name;
|
|
825
839
|
commands;
|
|
826
840
|
globalCommand;
|
|
@@ -914,7 +928,7 @@ var Command = class {
|
|
|
914
928
|
...command ? command.options : []
|
|
915
929
|
], mriOptions = getMriOptions(cliOptions), argsAfterDoubleDashes = [], doubleDashesIndex = argv.indexOf("--");
|
|
916
930
|
-1 !== doubleDashesIndex && (argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1), argv = argv.slice(0, doubleDashesIndex));
|
|
917
|
-
let parsed =
|
|
931
|
+
let parsed = mri(argv, mriOptions), args = (parsed = Object.keys(parsed).reduce((res, name)=>({
|
|
918
932
|
...res,
|
|
919
933
|
[camelcaseOptionName(name)]: parsed[name]
|
|
920
934
|
}), {
|
|
@@ -1460,7 +1474,38 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1460
1474
|
when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) {
|
|
1461
1475
|
return condition ? whenTruthy(this) : whenFalsy(this), this;
|
|
1462
1476
|
}
|
|
1463
|
-
})
|
|
1477
|
+
});
|
|
1478
|
+
function cloneValue(value, context) {
|
|
1479
|
+
if (null === value || 'object' != typeof value) return value;
|
|
1480
|
+
let seen = context.seen ??= new WeakMap();
|
|
1481
|
+
if (seen.has(value)) return seen.get(value);
|
|
1482
|
+
if (value instanceof RegExp) {
|
|
1483
|
+
let cloned = new RegExp(value.source, value.flags);
|
|
1484
|
+
return cloned.lastIndex = value.lastIndex, seen.set(value, cloned), cloned;
|
|
1485
|
+
}
|
|
1486
|
+
let prototype = Object.getPrototypeOf(value);
|
|
1487
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && null !== prototype) return value;
|
|
1488
|
+
let cloned = Array.isArray(value) ? Array(value.length) : Object.create(prototype);
|
|
1489
|
+
for (let key of (seen.set(value, cloned), Object.keys(value))){
|
|
1490
|
+
let clonedValue = cloneValue(value[key], context);
|
|
1491
|
+
'__proto__' === key ? Object.defineProperty(cloned, key, {
|
|
1492
|
+
value: clonedValue,
|
|
1493
|
+
enumerable: !0,
|
|
1494
|
+
configurable: !0,
|
|
1495
|
+
writable: !0
|
|
1496
|
+
}) : cloned[key] = clonedValue;
|
|
1497
|
+
}
|
|
1498
|
+
return cloned;
|
|
1499
|
+
}
|
|
1500
|
+
function cloneMap(source, context, cloned = new Map()) {
|
|
1501
|
+
for (let [key, value] of (cloned.clear(), source))cloned.set(key, cloneValue(value, context));
|
|
1502
|
+
return cloned;
|
|
1503
|
+
}
|
|
1504
|
+
function cloneSet(source, context, cloned = new Set()) {
|
|
1505
|
+
for (let value of (cloned.clear(), source))cloned.add(cloneValue(value, context));
|
|
1506
|
+
return cloned;
|
|
1507
|
+
}
|
|
1508
|
+
let childMaps = [
|
|
1464
1509
|
'alias',
|
|
1465
1510
|
'fallback',
|
|
1466
1511
|
'byDependency',
|
|
@@ -1477,7 +1522,8 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1477
1522
|
'restrictions',
|
|
1478
1523
|
'roots',
|
|
1479
1524
|
'modules'
|
|
1480
|
-
]
|
|
1525
|
+
];
|
|
1526
|
+
class Resolve extends ChainedMap {
|
|
1481
1527
|
constructor(parent){
|
|
1482
1528
|
super(parent), childMaps.forEach((key)=>{
|
|
1483
1529
|
this[key] = new ChainedMap(this);
|
|
@@ -1516,7 +1562,14 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1516
1562
|
...omissions
|
|
1517
1563
|
]);
|
|
1518
1564
|
}
|
|
1519
|
-
}
|
|
1565
|
+
}
|
|
1566
|
+
function cloneResolve(source, parent, context) {
|
|
1567
|
+
let cloned = new Resolve(parent);
|
|
1568
|
+
for (let key of (cloneMap(source.store, context, cloned.store), childMaps))cloneMap(source[key].store, context, cloned[key].store);
|
|
1569
|
+
for (let key of childSets)cloneSet(source[key].store, context, cloned[key].store);
|
|
1570
|
+
return cloned;
|
|
1571
|
+
}
|
|
1572
|
+
let ResolveLoader = class extends Resolve {
|
|
1520
1573
|
constructor(parent){
|
|
1521
1574
|
super(parent), this.modules = new ChainedSet(this), this.moduleExtensions = new ChainedSet(this), this.packageMains = new ChainedSet(this);
|
|
1522
1575
|
}
|
|
@@ -1696,6 +1749,9 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1696
1749
|
tap(f) {
|
|
1697
1750
|
return this.options(f(this.get('options'))), this;
|
|
1698
1751
|
}
|
|
1752
|
+
cloneFrom(source) {
|
|
1753
|
+
return source === this || (this.store = cloneMap(source.store, {})), this;
|
|
1754
|
+
}
|
|
1699
1755
|
merge(obj, omit = []) {
|
|
1700
1756
|
return !omit.includes('loader') && 'loader' in obj && this.loader(obj.loader), !omit.includes('options') && 'options' in obj && this.options(cjs(this.store.get('options') || {}, obj.options)), super.merge(obj, [
|
|
1701
1757
|
...omit,
|
|
@@ -1772,6 +1828,26 @@ let Rule = Orderable(class extends ChainedMap {
|
|
|
1772
1828
|
post() {
|
|
1773
1829
|
return this.enforce('post');
|
|
1774
1830
|
}
|
|
1831
|
+
cloneFrom(source) {
|
|
1832
|
+
return source === this ? this : this.#cloneFrom(source, {});
|
|
1833
|
+
}
|
|
1834
|
+
#cloneFrom(source, context) {
|
|
1835
|
+
let children = {};
|
|
1836
|
+
for (let key of [
|
|
1837
|
+
'uses',
|
|
1838
|
+
'rules',
|
|
1839
|
+
'oneOfs'
|
|
1840
|
+
]){
|
|
1841
|
+
let entries = new Map();
|
|
1842
|
+
for (let [name, child] of source[key].store){
|
|
1843
|
+
let cloned;
|
|
1844
|
+
'uses' === key ? (cloned = new Use(this, name), cloneMap(child.store, context, cloned.store)) : (cloned = new Rule(this, name, 'rules' === key ? 'rule' : 'oneOf')).#cloneFrom(child, context), cloned.__before = child.__before, cloned.__after = child.__after, entries.set(name, cloned);
|
|
1845
|
+
}
|
|
1846
|
+
children[key] = entries;
|
|
1847
|
+
}
|
|
1848
|
+
let resolve = source.#resolve ? cloneResolve(source.#resolve, this, context) : void 0;
|
|
1849
|
+
return cloneMap(source.store, context, this.store), cloneSet(source.include.store, context, this.include.store), cloneSet(source.exclude.store, context, this.exclude.store), this.uses.store = children.uses, this.rules.store = children.rules, this.oneOfs.store = children.oneOfs, this.#resolve = resolve, this;
|
|
1850
|
+
}
|
|
1775
1851
|
toConfig() {
|
|
1776
1852
|
let config = this.clean(Object.assign(this.entries() || {}, {
|
|
1777
1853
|
include: this.include.values(),
|
|
@@ -2165,7 +2241,7 @@ function formatStatsError(stats, root, level = 'error', logger) {
|
|
|
2165
2241
|
let innerError = '-- inner error --';
|
|
2166
2242
|
!verbose && message.includes(innerError) && (message = message.split(innerError)[0]);
|
|
2167
2243
|
let lines = (message = ((message)=>{
|
|
2168
|
-
if (
|
|
2244
|
+
if (!message.includes('produce different content for the same output file')) return message;
|
|
2169
2245
|
let extraMessage = `You may need to adjust ${color.yellow('output.filename')} configuration to prevent name conflicts. (See ${color.yellow('https://rsbuild.rs/config/output/filename')})`;
|
|
2170
2246
|
return `${message}\n${extraMessage}`;
|
|
2171
2247
|
})(message = ((message)=>{
|
|
@@ -2660,7 +2736,6 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2660
2736
|
return 2 === configs.length ? merge(configs[0], configs[1]) : 0 === configs.length ? {} : configs.reduce((result, config)=>merge(result, config), {});
|
|
2661
2737
|
}, defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, createDefaultConfig = ()=>({
|
|
2662
2738
|
dev: {
|
|
2663
|
-
hmr: !0,
|
|
2664
2739
|
liveReload: !0,
|
|
2665
2740
|
browserLogs: {
|
|
2666
2741
|
stackTrace: DEFAULT_STACK_TRACE
|
|
@@ -3290,7 +3365,7 @@ async function createContext(options, userConfig, logger, loadConfigResult) {
|
|
|
3290
3365
|
return config;
|
|
3291
3366
|
})(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, hooks = initHooks();
|
|
3292
3367
|
return {
|
|
3293
|
-
version: "2.3.
|
|
3368
|
+
version: "2.3.5",
|
|
3294
3369
|
rootPath,
|
|
3295
3370
|
configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
|
|
3296
3371
|
configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
|
|
@@ -3801,7 +3876,10 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3801
3876
|
if (config.mode) return config.mode;
|
|
3802
3877
|
let nodeEnv = process.env.NODE_ENV || '';
|
|
3803
3878
|
return 'production' === nodeEnv || 'development' === nodeEnv ? nodeEnv : 'none';
|
|
3804
|
-
})(),
|
|
3879
|
+
})(), defaultConfig.dev = {
|
|
3880
|
+
...defaultConfig.dev,
|
|
3881
|
+
hmr: 'development' === defaultConfig.mode
|
|
3882
|
+
}, mergeRsbuildConfig(defaultConfig, config)), environments = {}, mergedEnvironments = ((normalizedConfig, rootPath, specifiedEnvironments)=>{
|
|
3805
3883
|
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name), baseEnvironmentConfig = {
|
|
3806
3884
|
...baseConfig,
|
|
3807
3885
|
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
@@ -4272,7 +4350,7 @@ function getServerTerminator(server) {
|
|
|
4272
4350
|
}), ()=>new Promise((resolve, reject)=>{
|
|
4273
4351
|
for (let socket of pendingSockets)socket.destroy();
|
|
4274
4352
|
listened ? server.close((err)=>{
|
|
4275
|
-
err ? reject(err) : resolve();
|
|
4353
|
+
err && 'ERR_SERVER_NOT_RUNNING' !== err.code ? reject(err) : resolve();
|
|
4276
4354
|
}) : resolve();
|
|
4277
4355
|
});
|
|
4278
4356
|
}
|
|
@@ -5054,7 +5132,7 @@ function parseMinifyOptions(config) {
|
|
|
5054
5132
|
cssOptions: minify.cssOptions
|
|
5055
5133
|
};
|
|
5056
5134
|
}
|
|
5057
|
-
let postcss_load_config_src = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
5135
|
+
let postcss_load_config_src = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/b7f5a594bf00404e4e776a1083b3a0cfef602f460cf7e11269b23855d34ff149/node_modules/postcss-load-config/src/index.js");
|
|
5058
5136
|
var postcss_load_config_src_default = compatGetDefaultExport(postcss_load_config_src);
|
|
5059
5137
|
function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
5060
5138
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
@@ -5907,7 +5985,7 @@ function doesChunkBelongToHtml({ chunk, htmlPluginData }) {
|
|
|
5907
5985
|
let { options } = htmlPluginData.plugin;
|
|
5908
5986
|
return recursiveChunkEntryNames(chunk).some((chunkName)=>isChunksFiltered(chunkName, options?.chunks, options?.excludeChunks));
|
|
5909
5987
|
}
|
|
5910
|
-
let getManifestPlugin = cachedImport_cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire
|
|
5988
|
+
let getManifestPlugin = cachedImport_cachedImport(()=>import("./manifest-plugin.js").then(()=>rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/a5aff6a67a64dc2cd6fba2fe392c361454bba759c9980bb6bfe1a6686c72e73b/node_modules/rspack-manifest-plugin/dist/index.js"))), isCSSPath = (filePath)=>filePath.endsWith('.css');
|
|
5911
5989
|
function normalizeManifestObjectConfig(manifest) {
|
|
5912
5990
|
let defaultOptions = {
|
|
5913
5991
|
prefix: !0,
|
|
@@ -6343,7 +6421,6 @@ function getSplitChunksByPreset(config, preset) {
|
|
|
6343
6421
|
throw Error(`[rsbuild] Unknown splitChunks preset: ${String(preset)}`);
|
|
6344
6422
|
}
|
|
6345
6423
|
}
|
|
6346
|
-
let builtinSwcLoaderName = 'builtin:swc-loader';
|
|
6347
6424
|
function applyScriptCondition({ rule, isDev, config, rsbuildTarget }) {
|
|
6348
6425
|
for (let condition of (rule.include.add({
|
|
6349
6426
|
not: NODE_MODULES_REGEX
|
|
@@ -6629,7 +6706,7 @@ function destroyStream(stream, suppress) {
|
|
|
6629
6706
|
'number' == typeof fd && this.close();
|
|
6630
6707
|
}), 'function' == typeof stream.addListener && suppress && (stream.removeAllListeners('error'), stream.addListener('error', ()=>{}));
|
|
6631
6708
|
}
|
|
6632
|
-
let getRangeParser = cachedImport_cachedImport(()=>import("./range-parser.js")
|
|
6709
|
+
let getRangeParser = cachedImport_cachedImport(()=>import("./range-parser.js"));
|
|
6633
6710
|
function sendError(res, code) {
|
|
6634
6711
|
let content = {
|
|
6635
6712
|
400: 'Bad Request',
|
|
@@ -6698,18 +6775,19 @@ function createAssetsMiddleware(context, { waitForAssets, waitForBuild }, output
|
|
|
6698
6775
|
return;
|
|
6699
6776
|
}
|
|
6700
6777
|
}
|
|
6701
|
-
if (rangeHeader) {
|
|
6702
|
-
let
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
combine: !0
|
|
6706
|
-
});
|
|
6707
|
-
})(`${size}|${rangeHeader}`);
|
|
6708
|
-
if (isRangeFresh(req.headers, res) || (parsedRanges = []), -1 === parsedRanges) {
|
|
6778
|
+
if (rangeHeader && isRangeFresh(req.headers, res)) {
|
|
6779
|
+
let { parse, combineRanges } = await getRangeParser(), { code, ranges } = parse(size, rangeHeader);
|
|
6780
|
+
if (1 === code || 3 === code) logger.error("[rsbuild:middleware] A malformed 'Range' header was provided. A regular response will be sent for this request.");
|
|
6781
|
+
else if (2 === code && 0 === ranges.length) {
|
|
6709
6782
|
logger.error("[rsbuild:middleware] Unsatisfiable range for 'Range' header."), res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size)), sendError(res, 416);
|
|
6710
6783
|
return;
|
|
6784
|
+
} else if (ranges.length > 0) {
|
|
6785
|
+
let combined = ranges.length > 1 ? combineRanges(ranges) : ranges;
|
|
6786
|
+
if (1 === combined.length) {
|
|
6787
|
+
let [range] = combined;
|
|
6788
|
+
res.statusCode = 206, res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size, range)), [offset, len] = getOffsetAndLenFromRange(range);
|
|
6789
|
+
} else logger.error("[rsbuild:middleware] A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request.");
|
|
6711
6790
|
}
|
|
6712
|
-
-2 === parsedRanges ? logger.error("[rsbuild:middleware] A malformed 'Range' header was provided. A regular response will be sent for this request.") : parsedRanges.length > 1 && logger.error("[rsbuild:middleware] A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request."), -2 !== parsedRanges && 1 === parsedRanges.length && (res.statusCode = 206, res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size, parsedRanges[0])), [offset, len] = getOffsetAndLenFromRange(parsedRanges[0]));
|
|
6713
6791
|
}
|
|
6714
6792
|
if ('HEAD' === req.method) {
|
|
6715
6793
|
res.setHeader('Content-Length', len), 404 === res.statusCode && (res.statusCode = 200), res.end();
|
|
@@ -6744,16 +6822,20 @@ function setupMemoryFileSystemCleanup(fileSystem, compilers) {
|
|
|
6744
6822
|
if (compilers.some((compiler)=>compiler.options.output.clean)) return;
|
|
6745
6823
|
let lastSeenByCompiler = compilers.map(()=>new Map());
|
|
6746
6824
|
for (let [index, compiler] of compilers.entries()){
|
|
6747
|
-
let lastHash, lastSeen = lastSeenByCompiler[index], generation = 0;
|
|
6825
|
+
let lastHash, lastSeen = lastSeenByCompiler[index], expiresAt = new Map(), generation = 0;
|
|
6748
6826
|
compiler.hooks.afterEmit.tap('rsbuild:clean-memory-filesystem', (compilation)=>{
|
|
6749
6827
|
if (compilation.errors.length) return;
|
|
6750
|
-
|
|
6828
|
+
let now = performance.now();
|
|
6829
|
+
for (let [retiredGeneration, deadline] of (compilation.hash !== lastHash && (generation > 0 && expiresAt.set(generation, now + 30000), generation++, lastHash = compilation.hash), expiresAt)){
|
|
6830
|
+
if (deadline > now) break;
|
|
6831
|
+
expiresAt.delete(retiredGeneration);
|
|
6832
|
+
}
|
|
6751
6833
|
let outputPath = compilation.getPath(compiler.outputPath);
|
|
6752
6834
|
for (let name of getAssetNames(compilation)){
|
|
6753
6835
|
let queryIndex = name.indexOf('?'), filename = -1 === queryIndex ? name : name.slice(0, queryIndex), filePath = join(outputPath, filename);
|
|
6754
6836
|
lastSeen.set(filePath, generation);
|
|
6755
6837
|
}
|
|
6756
|
-
for (let [filePath, seen] of lastSeen)if (!(seen >= generation - 1) && (lastSeen.delete(filePath), !lastSeenByCompiler.some((assets)=>assets.has(filePath)))) try {
|
|
6838
|
+
for (let [filePath, seen] of lastSeen)if (!(seen >= generation - 1 || expiresAt.has(seen)) && (lastSeen.delete(filePath), !lastSeenByCompiler.some((assets)=>assets.has(filePath)))) try {
|
|
6757
6839
|
fileSystem.unlinkSync(filePath);
|
|
6758
6840
|
} catch (error) {
|
|
6759
6841
|
if ('ENOENT' !== error.code) throw error;
|
|
@@ -7076,8 +7158,9 @@ class SocketServer {
|
|
|
7076
7158
|
currentHash = new Map();
|
|
7077
7159
|
environmentStats = new Map();
|
|
7078
7160
|
onSocketConnect;
|
|
7079
|
-
|
|
7080
|
-
|
|
7161
|
+
onSocketCustomMessage;
|
|
7162
|
+
constructor(context, options, getOutputFileSystem, onSocketConnect, onSocketCustomMessage){
|
|
7163
|
+
this.context = context, this.options = options, this.getOutputFileSystem = getOutputFileSystem, this.onSocketConnect = onSocketConnect, this.onSocketCustomMessage = onSocketCustomMessage;
|
|
7081
7164
|
}
|
|
7082
7165
|
upgrade = (req, socket, head)=>{
|
|
7083
7166
|
if (!this.wsServer.shouldHandle(req)) return;
|
|
@@ -7155,7 +7238,7 @@ class SocketServer {
|
|
|
7155
7238
|
} else for (let sockets of this.socketsMap.values())sendToSockets(sockets);
|
|
7156
7239
|
}
|
|
7157
7240
|
async close() {
|
|
7158
|
-
for (let socket of (this.clearHeartbeatTimer(), this.onSocketConnect = void 0, this.wsServer.removeAllListeners(), this.wsServer.clients))socket.terminate();
|
|
7241
|
+
for (let socket of (this.clearHeartbeatTimer(), this.onSocketConnect = void 0, this.onSocketCustomMessage = void 0, this.wsServer.removeAllListeners(), this.wsServer.clients))socket.terminate();
|
|
7159
7242
|
for (let sockets of this.socketsMap.values())sockets.forEach((socket)=>{
|
|
7160
7243
|
socket.close();
|
|
7161
7244
|
});
|
|
@@ -7174,6 +7257,10 @@ class SocketServer {
|
|
|
7174
7257
|
if (!context.normalizedConfig) return;
|
|
7175
7258
|
let environment = this.getEnvironmentByToken(token);
|
|
7176
7259
|
if (!environment) return;
|
|
7260
|
+
if ('custom' === payload.type) {
|
|
7261
|
+
'string' == typeof payload.event && this.onSocketCustomMessage?.(socket, token, payload.event, payload.data);
|
|
7262
|
+
return;
|
|
7263
|
+
}
|
|
7177
7264
|
let { browserLogs, client } = environment.config.dev;
|
|
7178
7265
|
if ('client-error' === payload.type && !context.buildState.hasErrors && browserLogs) {
|
|
7179
7266
|
let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null, cache = {
|
|
@@ -7296,8 +7383,8 @@ class BuildManager {
|
|
|
7296
7383
|
config;
|
|
7297
7384
|
resolvedPort;
|
|
7298
7385
|
context;
|
|
7299
|
-
constructor({ config, context, compiler, resolvedPort, onSocketConnect }){
|
|
7300
|
-
this.config = config, this.context = context, this.compiler = compiler, this.resolvedPort = resolvedPort, this.outputFileSystem = node_fs, this.socketServer = new SocketServer(context, config.dev, ()=>this.outputFileSystem, onSocketConnect), this.context.socketServer = this.socketServer;
|
|
7386
|
+
constructor({ config, context, compiler, resolvedPort, onSocketConnect, onSocketCustomMessage }){
|
|
7387
|
+
this.config = config, this.context = context, this.compiler = compiler, this.resolvedPort = resolvedPort, this.outputFileSystem = node_fs, this.socketServer = new SocketServer(context, config.dev, ()=>this.outputFileSystem, onSocketConnect, onSocketCustomMessage), this.context.socketServer = this.socketServer;
|
|
7301
7388
|
}
|
|
7302
7389
|
async init() {
|
|
7303
7390
|
await this.setupCompilationMiddleware(), await this.socketServer.prepare();
|
|
@@ -7495,7 +7582,15 @@ let createDeferred = ()=>{
|
|
|
7495
7582
|
return deferred.promise = new Promise((resolve)=>{
|
|
7496
7583
|
deferred.resolve = resolve;
|
|
7497
7584
|
}), deferred;
|
|
7498
|
-
}, ENCODING_REGEX = /\bgzip\b/,
|
|
7585
|
+
}, ENCODING_REGEX = /\bgzip\b/, TEXT_LIKE_MIME_TYPE = /text|javascript|\/json|xml|\+(?:json|yaml)$/, COMPRESSIBLE_ASSET_TYPES = new Set([
|
|
7586
|
+
'application/toml',
|
|
7587
|
+
'application/wasm',
|
|
7588
|
+
'application/yaml',
|
|
7589
|
+
'font/collection',
|
|
7590
|
+
'font/otf',
|
|
7591
|
+
'font/ttf',
|
|
7592
|
+
'image/bmp'
|
|
7593
|
+
]);
|
|
7499
7594
|
function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_BEST_SPEED } = {}) {
|
|
7500
7595
|
return function gzipMiddleware(req, res, next) {
|
|
7501
7596
|
let gzip, writeHeadStatus, writeHeadMessage;
|
|
@@ -7509,12 +7604,13 @@ function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_B
|
|
|
7509
7604
|
let start = ()=>{
|
|
7510
7605
|
if (started) return;
|
|
7511
7606
|
if (started = !0, ((res)=>{
|
|
7607
|
+
var contentType;
|
|
7512
7608
|
let index;
|
|
7513
7609
|
if (res.getHeader('Content-Encoding')) return !1;
|
|
7514
|
-
let
|
|
7515
|
-
if (!
|
|
7516
|
-
let
|
|
7517
|
-
if (
|
|
7610
|
+
let contentType1 = res.getHeader('Content-Type');
|
|
7611
|
+
if (!contentType1) return !1;
|
|
7612
|
+
let mimeType = (-1 === (index = (contentType = String(contentType1)).indexOf(';')) ? contentType : contentType.slice(0, index)).trim().toLowerCase();
|
|
7613
|
+
if ('text/event-stream' === mimeType || !TEXT_LIKE_MIME_TYPE.test(mimeType) && !COMPRESSIBLE_ASSET_TYPES.has(mimeType)) return !1;
|
|
7518
7614
|
let size = res.getHeader('Content-Length');
|
|
7519
7615
|
return void 0 === size || Number(size) > 1024;
|
|
7520
7616
|
})(res)) {
|
|
@@ -8104,7 +8200,22 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8104
8200
|
let currentStats = stats[index];
|
|
8105
8201
|
return currentStats || waiters[index].promise;
|
|
8106
8202
|
}
|
|
8107
|
-
}), hotConnectCallbacks = new Map(),
|
|
8203
|
+
}), hotConnectCallbacks = new Map(), hotEventCallbacks = new Map(), hotClients = new WeakMap(), getHotClient = (socket)=>{
|
|
8204
|
+
let client = hotClients.get(socket);
|
|
8205
|
+
return client || (client = {
|
|
8206
|
+
send: createHotSend(socket)
|
|
8207
|
+
}, hotClients.set(socket, client)), client;
|
|
8208
|
+
}, runHotCallbacks = (callbacks, ...args)=>{
|
|
8209
|
+
for (let callback of [
|
|
8210
|
+
...callbacks
|
|
8211
|
+
])try {
|
|
8212
|
+
Promise.resolve(callback(...args)).catch((error)=>{
|
|
8213
|
+
logger.error(error);
|
|
8214
|
+
});
|
|
8215
|
+
} catch (error) {
|
|
8216
|
+
logger.error(error);
|
|
8217
|
+
}
|
|
8218
|
+
}, protocol = isHttps ? 'https' : 'http', urls = await getAddressUrls({
|
|
8108
8219
|
protocol,
|
|
8109
8220
|
port,
|
|
8110
8221
|
host
|
|
@@ -8128,7 +8239,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8128
8239
|
logger
|
|
8129
8240
|
}), state = {}, webSocketServers = new Set(), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServerResources = ()=>{
|
|
8130
8241
|
if (closingPromise) return closingPromise;
|
|
8131
|
-
hotConnectCallbacks = void 0;
|
|
8242
|
+
hotConnectCallbacks = void 0, hotEventCallbacks = void 0;
|
|
8132
8243
|
let onUpgrade = state.devMiddlewares?.onUpgrade;
|
|
8133
8244
|
if (onUpgrade && webSocketServers) for (let server of webSocketServers)server.removeListener('upgrade', onUpgrade);
|
|
8134
8245
|
return webSocketServers = void 0, unregisterRestart?.(), unregisterRestart = void 0, closingPromise = (async ()=>{
|
|
@@ -8185,6 +8296,16 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8185
8296
|
return callbacks || (callbacks = new Set(), hotConnectCallbacks.set(webSocketToken, callbacks)), callbacks.add(callback), ()=>{
|
|
8186
8297
|
hotConnectCallbacks?.get(webSocketToken)?.delete(callback);
|
|
8187
8298
|
};
|
|
8299
|
+
},
|
|
8300
|
+
on: (event, callback)=>{
|
|
8301
|
+
if (!runCompile) throw Error(getErrorMsg('hot.on'));
|
|
8302
|
+
if (!hotEventCallbacks) return ()=>{};
|
|
8303
|
+
let events = hotEventCallbacks.get(webSocketToken);
|
|
8304
|
+
events || (events = new Map(), hotEventCallbacks.set(webSocketToken, events));
|
|
8305
|
+
let callbacks = events.get(event);
|
|
8306
|
+
return callbacks || (callbacks = new Set(), events.set(event, callbacks)), callbacks.add(callback), ()=>{
|
|
8307
|
+
hotEventCallbacks?.get(webSocketToken)?.get(event)?.delete(callback);
|
|
8308
|
+
};
|
|
8188
8309
|
}
|
|
8189
8310
|
},
|
|
8190
8311
|
getStats: async ()=>{
|
|
@@ -8297,19 +8418,11 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8297
8418
|
resolvedPort: port,
|
|
8298
8419
|
onSocketConnect: (socket, token)=>{
|
|
8299
8420
|
let callbacks = hotConnectCallbacks?.get(token);
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
...callbacks
|
|
8306
|
-
])try {
|
|
8307
|
-
Promise.resolve(callback(client)).catch((error)=>{
|
|
8308
|
-
logger.error(error);
|
|
8309
|
-
});
|
|
8310
|
-
} catch (error) {
|
|
8311
|
-
logger.error(error);
|
|
8312
|
-
}
|
|
8421
|
+
callbacks?.size && runHotCallbacks(callbacks, getHotClient(socket));
|
|
8422
|
+
},
|
|
8423
|
+
onSocketCustomMessage: (socket, token, event, data)=>{
|
|
8424
|
+
let callbacks = hotEventCallbacks?.get(token)?.get(event);
|
|
8425
|
+
callbacks?.size && runHotCallbacks(callbacks, data, getHotClient(socket));
|
|
8313
8426
|
}
|
|
8314
8427
|
});
|
|
8315
8428
|
return await buildManager.init(), buildManager;
|
|
@@ -8621,7 +8734,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8621
8734
|
javascript: {
|
|
8622
8735
|
typeReexportsPresence: 'tolerant'
|
|
8623
8736
|
}
|
|
8624
|
-
}), isProd && chain.optimization.chunkIds('compact-hashed').moduleIds('compact-hashed'),
|
|
8737
|
+
}), isProd && chain.optimization.chunkIds('compact-hashed').moduleIds('compact-hashed'), config.dev.hmr && 'web' === target && (isDev || 'none' === config.mode && 'dev' === api.context.action) && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(rspack.HotModuleReplacementPlugin);
|
|
8625
8738
|
});
|
|
8626
8739
|
}
|
|
8627
8740
|
},
|
|
@@ -8725,7 +8838,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8725
8838
|
...chain.get('experiments'),
|
|
8726
8839
|
newCache: !0
|
|
8727
8840
|
}), cacheEnabled = !0;
|
|
8728
|
-
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = getCacheDirectory(cacheConfig, context), buildDependencies = await getBuildDependencies(context, environment, cacheConfig.buildDependencies), useDigest = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length, cacheVersion = `rsbuild-2.3.
|
|
8841
|
+
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = getCacheDirectory(cacheConfig, context), buildDependencies = await getBuildDependencies(context, environment, cacheConfig.buildDependencies), useDigest = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length, cacheVersion = `rsbuild-2.3.5-${environment.name}-${env}`;
|
|
8729
8842
|
chain.cache({
|
|
8730
8843
|
type: 'persistent',
|
|
8731
8844
|
version: useDigest ? `${cacheVersion}-${await helpers_hash(JSON.stringify(cacheConfig.cacheDigest))}` : cacheVersion,
|
|
@@ -9546,7 +9659,7 @@ try {
|
|
|
9546
9659
|
config: config.tools.swc,
|
|
9547
9660
|
mergeFn: cjs_0_default()
|
|
9548
9661
|
});
|
|
9549
|
-
mergedConfig.jsc?.target !== void 0 && mergedConfig.env?.targets !== void 0 && 1 === Object.keys(mergedConfig.env).length && delete mergedConfig.env, mainRule.use(CHAIN_ID.USE.SWC).loader(
|
|
9662
|
+
mergedConfig.jsc?.target !== void 0 && mergedConfig.env?.targets !== void 0 && 1 === Object.keys(mergedConfig.env).length && delete mergedConfig.env, mainRule.use(CHAIN_ID.USE.SWC).loader('builtin:swc-loader').options(mergedConfig), dataUriRule.resolve.set('fullySpecified', !1).end().use(CHAIN_ID.USE.SWC).cloneFrom(mainRule.use(CHAIN_ID.USE.SWC));
|
|
9550
9663
|
}
|
|
9551
9664
|
});
|
|
9552
9665
|
}
|
|
@@ -10478,7 +10591,7 @@ let applyServerOptions = (command)=>{
|
|
|
10478
10591
|
};
|
|
10479
10592
|
function setupCommands(argv) {
|
|
10480
10593
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10481
|
-
cli.version("2.3.
|
|
10594
|
+
cli.version("2.3.5"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
10482
10595
|
default: 'auto'
|
|
10483
10596
|
}).option('--dist-path <dir>', 'Set the root directory of output files').option('--source-map', 'Enable source map').option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
10484
10597
|
type: [
|
|
@@ -10543,7 +10656,7 @@ function setupCommands(argv) {
|
|
|
10543
10656
|
}
|
|
10544
10657
|
function showGreeting() {
|
|
10545
10658
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10546
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.3.
|
|
10659
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.3.5\n`);
|
|
10547
10660
|
}
|
|
10548
10661
|
function setupLogLevel(argv) {
|
|
10549
10662
|
if (argv.length <= 3) return;
|
|
@@ -10565,5 +10678,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10565
10678
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10566
10679
|
}
|
|
10567
10680
|
}
|
|
10568
|
-
let src_version = "2.3.
|
|
10681
|
+
let src_version = "2.3.5";
|
|
10569
10682
|
export { core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
|