@rsbuild/core 1.6.12 → 1.6.14
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 +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/0~range-parser.js +1 -1
- package/dist/131.js +198 -90
- package/dist/2~open.cjs +1 -1
- package/dist/2~range-parser.cjs +1 -1
- package/dist/client/59.js +22 -0
- package/dist/client/hmr.js +12 -10
- package/dist/client/overlay.js +3 -2
- package/dist/index.cjs +206 -97
- package/dist-types/client/hmr.d.ts +3 -2
- package/dist-types/client/log.d.ts +13 -0
- package/dist-types/helpers/format.d.ts +1 -1
- package/dist-types/helpers/stats.d.ts +1 -1
- package/dist-types/plugins/fileSize.d.ts +2 -0
- package/dist-types/types/config.d.ts +66 -45
- package/dist-types/types/index.d.ts +8 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! For license information please see index.cjs.LICENSE.txt */
|
|
2
2
|
const __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
"../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"
|
|
4
|
+
"../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
5
5
|
"use strict";
|
|
6
6
|
var isMergeableObject = function isMergeableObject(value) {
|
|
7
7
|
return isNonNullObject(value) && !isSpecial(value);
|
|
@@ -71,7 +71,7 @@ var __webpack_modules__ = {
|
|
|
71
71
|
}, {});
|
|
72
72
|
}, module.exports = deepmerge;
|
|
73
73
|
},
|
|
74
|
-
"../../node_modules/.pnpm/dotenv-expand@12.0.3/node_modules/dotenv-expand/lib/main.js"
|
|
74
|
+
"../../node_modules/.pnpm/dotenv-expand@12.0.3/node_modules/dotenv-expand/lib/main.js" (module) {
|
|
75
75
|
"use strict";
|
|
76
76
|
function _resolveEscapeSequences(value) {
|
|
77
77
|
return value.replace(/\\\$/g, '$');
|
|
@@ -104,7 +104,7 @@ var __webpack_modules__ = {
|
|
|
104
104
|
}
|
|
105
105
|
module.exports.expand = expand;
|
|
106
106
|
},
|
|
107
|
-
"../../node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js"
|
|
107
|
+
"../../node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js" (module) {
|
|
108
108
|
"use strict";
|
|
109
109
|
function listener(event, done) {
|
|
110
110
|
return function onevent(arg1) {
|
|
@@ -138,7 +138,7 @@ var __webpack_modules__ = {
|
|
|
138
138
|
return thunk.cancel = cleanup, thunk;
|
|
139
139
|
};
|
|
140
140
|
},
|
|
141
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js"
|
|
141
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_webpack_module, exports1) {
|
|
142
142
|
"use strict";
|
|
143
143
|
Object.defineProperty(exports1, "__esModule", {
|
|
144
144
|
value: !0
|
|
@@ -150,7 +150,7 @@ var __webpack_modules__ = {
|
|
|
150
150
|
return `[${eol}${values}${eol}]`;
|
|
151
151
|
};
|
|
152
152
|
},
|
|
153
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"
|
|
153
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_webpack_module, exports1, __webpack_require__) {
|
|
154
154
|
"use strict";
|
|
155
155
|
Object.defineProperty(exports1, "__esModule", {
|
|
156
156
|
value: !0
|
|
@@ -289,7 +289,7 @@ var __webpack_modules__ = {
|
|
|
289
289
|
}
|
|
290
290
|
exports1.FunctionParser = FunctionParser;
|
|
291
291
|
},
|
|
292
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"
|
|
292
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_webpack_module, exports1, __webpack_require__) {
|
|
293
293
|
"use strict";
|
|
294
294
|
exports1.stringify = void 0;
|
|
295
295
|
let stringify_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
|
|
@@ -326,7 +326,7 @@ var __webpack_modules__ = {
|
|
|
326
326
|
return result;
|
|
327
327
|
};
|
|
328
328
|
},
|
|
329
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"
|
|
329
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_webpack_module, exports1, __webpack_require__) {
|
|
330
330
|
"use strict";
|
|
331
331
|
Object.defineProperty(exports1, "__esModule", {
|
|
332
332
|
value: !0
|
|
@@ -361,7 +361,7 @@ var __webpack_modules__ = {
|
|
|
361
361
|
"[object Window]": globalToString
|
|
362
362
|
};
|
|
363
363
|
},
|
|
364
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"
|
|
364
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_webpack_module, exports1) {
|
|
365
365
|
"use strict";
|
|
366
366
|
Object.defineProperty(exports1, "__esModule", {
|
|
367
367
|
value: !0
|
|
@@ -418,7 +418,7 @@ var __webpack_modules__ = {
|
|
|
418
418
|
return result;
|
|
419
419
|
};
|
|
420
420
|
},
|
|
421
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"
|
|
421
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_webpack_module, exports1, __webpack_require__) {
|
|
422
422
|
"use strict";
|
|
423
423
|
Object.defineProperty(exports1, "__esModule", {
|
|
424
424
|
value: !0
|
|
@@ -438,7 +438,7 @@ var __webpack_modules__ = {
|
|
|
438
438
|
};
|
|
439
439
|
exports1.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
|
|
440
440
|
},
|
|
441
|
-
"../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"
|
|
441
|
+
"../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
442
442
|
let path = __webpack_require__("path"), fs = __webpack_require__("fs"), os = __webpack_require__("os"), url = __webpack_require__("url"), fsReadFileAsync = fs.promises.readFile;
|
|
443
443
|
function getDefaultSearchPlaces(name, sync) {
|
|
444
444
|
return [
|
|
@@ -693,7 +693,7 @@ var __webpack_modules__ = {
|
|
|
693
693
|
};
|
|
694
694
|
};
|
|
695
695
|
},
|
|
696
|
-
"../../node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js"
|
|
696
|
+
"../../node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
697
697
|
"use strict";
|
|
698
698
|
module.exports = onFinished, module.exports.isFinished = isFinished;
|
|
699
699
|
var asyncHooks = tryRequireAsyncHooks(), first = __webpack_require__("../../node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
|
|
@@ -760,7 +760,7 @@ var __webpack_modules__ = {
|
|
|
760
760
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
761
761
|
}
|
|
762
762
|
},
|
|
763
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js"
|
|
763
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
764
764
|
let yaml, { resolve } = __webpack_require__("node:path"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js");
|
|
765
765
|
async function processResult(ctx, result) {
|
|
766
766
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
@@ -834,7 +834,7 @@ var __webpack_modules__ = {
|
|
|
834
834
|
});
|
|
835
835
|
};
|
|
836
836
|
},
|
|
837
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js"
|
|
837
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
838
838
|
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js");
|
|
839
839
|
module.exports = async function options(config, file) {
|
|
840
840
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
@@ -855,7 +855,7 @@ var __webpack_modules__ = {
|
|
|
855
855
|
return config;
|
|
856
856
|
};
|
|
857
857
|
},
|
|
858
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js"
|
|
858
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
859
859
|
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js");
|
|
860
860
|
async function load(plugin, options, file) {
|
|
861
861
|
try {
|
|
@@ -872,7 +872,7 @@ var __webpack_modules__ = {
|
|
|
872
872
|
}), list;
|
|
873
873
|
};
|
|
874
874
|
},
|
|
875
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js"
|
|
875
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
876
876
|
let tsx, jiti, { createRequire } = __webpack_require__("node:module"), { pathToFileURL } = __webpack_require__("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
877
877
|
module.exports = async function req(name, rootFile = __filename) {
|
|
878
878
|
let url = createRequire(rootFile).resolve(name);
|
|
@@ -901,63 +901,63 @@ var __webpack_modules__ = {
|
|
|
901
901
|
throw Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.map((error)=>error.message).join('\n')}`);
|
|
902
902
|
};
|
|
903
903
|
},
|
|
904
|
-
async_hooks
|
|
904
|
+
async_hooks (module) {
|
|
905
905
|
"use strict";
|
|
906
906
|
module.exports = require("async_hooks");
|
|
907
907
|
},
|
|
908
|
-
fs
|
|
908
|
+
fs (module) {
|
|
909
909
|
"use strict";
|
|
910
910
|
module.exports = require("fs");
|
|
911
911
|
},
|
|
912
|
-
"node:buffer"
|
|
912
|
+
"node:buffer" (module) {
|
|
913
913
|
"use strict";
|
|
914
914
|
module.exports = require("node:buffer");
|
|
915
915
|
},
|
|
916
|
-
"node:child_process"
|
|
916
|
+
"node:child_process" (module) {
|
|
917
917
|
"use strict";
|
|
918
918
|
module.exports = require("node:child_process");
|
|
919
919
|
},
|
|
920
|
-
"node:fs"
|
|
920
|
+
"node:fs" (module) {
|
|
921
921
|
"use strict";
|
|
922
922
|
module.exports = require("node:fs");
|
|
923
923
|
},
|
|
924
|
-
"node:fs/promises"
|
|
924
|
+
"node:fs/promises" (module) {
|
|
925
925
|
"use strict";
|
|
926
926
|
module.exports = require("node:fs/promises");
|
|
927
927
|
},
|
|
928
|
-
"node:module"
|
|
928
|
+
"node:module" (module) {
|
|
929
929
|
"use strict";
|
|
930
930
|
module.exports = require("node:module");
|
|
931
931
|
},
|
|
932
|
-
"node:os"
|
|
932
|
+
"node:os" (module) {
|
|
933
933
|
"use strict";
|
|
934
934
|
module.exports = require("node:os");
|
|
935
935
|
},
|
|
936
|
-
"node:path"
|
|
936
|
+
"node:path" (module) {
|
|
937
937
|
"use strict";
|
|
938
938
|
module.exports = require("node:path");
|
|
939
939
|
},
|
|
940
|
-
"node:process"
|
|
940
|
+
"node:process" (module) {
|
|
941
941
|
"use strict";
|
|
942
942
|
module.exports = require("node:process");
|
|
943
943
|
},
|
|
944
|
-
"node:url"
|
|
944
|
+
"node:url" (module) {
|
|
945
945
|
"use strict";
|
|
946
946
|
module.exports = require("node:url");
|
|
947
947
|
},
|
|
948
|
-
"node:util"
|
|
948
|
+
"node:util" (module) {
|
|
949
949
|
"use strict";
|
|
950
950
|
module.exports = require("node:util");
|
|
951
951
|
},
|
|
952
|
-
os
|
|
952
|
+
os (module) {
|
|
953
953
|
"use strict";
|
|
954
954
|
module.exports = require("os");
|
|
955
955
|
},
|
|
956
|
-
path
|
|
956
|
+
path (module) {
|
|
957
957
|
"use strict";
|
|
958
958
|
module.exports = require("path");
|
|
959
959
|
},
|
|
960
|
-
url
|
|
960
|
+
url (module) {
|
|
961
961
|
"use strict";
|
|
962
962
|
module.exports = require("url");
|
|
963
963
|
}
|
|
@@ -1021,7 +1021,7 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
1021
1021
|
};
|
|
1022
1022
|
})();
|
|
1023
1023
|
var __webpack_exports__ = {};
|
|
1024
|
-
for(var
|
|
1024
|
+
for(var __rspack_i in (()=>{
|
|
1025
1025
|
"use strict";
|
|
1026
1026
|
let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
|
|
1027
1027
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
@@ -2488,6 +2488,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2488
2488
|
MultiStatsCtor
|
|
2489
2489
|
});
|
|
2490
2490
|
};
|
|
2491
|
+
var external_node_util_ = __webpack_require__("node:util");
|
|
2491
2492
|
function resolveFileName(stats) {
|
|
2492
2493
|
let file = stats.file || stats.moduleName;
|
|
2493
2494
|
if (file) return removeLoaderChainDelimiter(file);
|
|
@@ -2502,11 +2503,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2502
2503
|
}
|
|
2503
2504
|
function formatModuleTrace(stats, errorFile) {
|
|
2504
2505
|
if (!stats.moduleTrace) return;
|
|
2505
|
-
let moduleNames = stats.moduleTrace.map((trace)=>trace.originName).filter(Boolean);
|
|
2506
|
+
let moduleNames = stats.moduleTrace.map((trace)=>trace.originName && removeLoaderChainDelimiter(trace.originName)).filter(Boolean);
|
|
2506
2507
|
if (!moduleNames.length) return;
|
|
2507
|
-
|
|
2508
|
+
if (errorFile) {
|
|
2509
|
+
let formatted = removeLoaderChainDelimiter(errorFile);
|
|
2510
|
+
moduleNames[0] !== formatted && moduleNames.unshift(formatted);
|
|
2511
|
+
}
|
|
2508
2512
|
let rawTrace = moduleNames.reverse().map((item)=>`\n ${item}`).join('');
|
|
2509
|
-
return color.dim(`Import traces (entry → error):${rawTrace}`);
|
|
2513
|
+
return color.dim(`Import traces (entry → error):${rawTrace} ${color.bold(color.red('×'))}`);
|
|
2510
2514
|
}
|
|
2511
2515
|
function hintUnknownFiles(message) {
|
|
2512
2516
|
let hint = 'You may need an appropriate loader to handle this file type.';
|
|
@@ -2548,16 +2552,17 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2548
2552
|
])if (plugin.test.test(message)) return message.replace(hint, plugin.hint);
|
|
2549
2553
|
return message;
|
|
2550
2554
|
}
|
|
2551
|
-
function formatStatsError(stats) {
|
|
2552
|
-
let fileName = resolveFileName(stats), message = `${((fileName, stats)=>{
|
|
2555
|
+
function formatStatsError(stats, root) {
|
|
2556
|
+
let fileName = resolveFileName(stats), message = `${((fileName, stats, root)=>{
|
|
2553
2557
|
if (!fileName) return '';
|
|
2554
2558
|
let DATA_URI_PREFIX = "data:text/javascript,";
|
|
2555
2559
|
if (fileName.startsWith(DATA_URI_PREFIX)) {
|
|
2556
2560
|
let snippet = fileName.replace(DATA_URI_PREFIX, '');
|
|
2557
2561
|
return snippet.length > 30 && (snippet = `${snippet.slice(0, 30)}...`), `File: ${color.cyan('data-uri virtual module')} ${color.dim(`(${snippet})`)}\n`;
|
|
2558
2562
|
}
|
|
2559
|
-
|
|
2560
|
-
|
|
2563
|
+
let prefix = root + external_node_path_.sep;
|
|
2564
|
+
return (fileName.startsWith(prefix) && (fileName = fileName.replace(prefix, `.${external_node_path_.sep}`)), /:\d+:\d+/.test(fileName)) ? `File: ${color.cyan(fileName)}\n` : stats.loc ? `File: ${color.cyan(`${fileName}:${stats.loc}`)}\n` : `File: ${color.cyan(`${fileName}:1:1`)}\n`;
|
|
2565
|
+
})(fileName, stats, root)}${stats.message}`, verbose = 'verbose' === logger.level;
|
|
2561
2566
|
verbose && (stats.details && (message += `\nDetails: ${stats.details}\n`), stats.stack && (message += `\n${stats.stack}`));
|
|
2562
2567
|
let moduleTrace = formatModuleTrace(stats, fileName);
|
|
2563
2568
|
moduleTrace && (message += moduleTrace);
|
|
@@ -2579,7 +2584,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2579
2584
|
};
|
|
2580
2585
|
if (message.includes('need an additional plugin to handle "node:" URIs')) return getTips('node:*');
|
|
2581
2586
|
if (!message.includes("Can't resolve")) return message;
|
|
2582
|
-
let matchArray = message.match(/Can't resolve '(\w+)'/);
|
|
2587
|
+
let matchArray = (0, external_node_util_.stripVTControlCharacters)(message).match(/Can't resolve '(\w+)'/);
|
|
2583
2588
|
if (!matchArray) return message;
|
|
2584
2589
|
let moduleName = matchArray[1];
|
|
2585
2590
|
return moduleName && [
|
|
@@ -2663,12 +2668,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2663
2668
|
let statsOptions = getStatsOptions(compiler, action);
|
|
2664
2669
|
return statsInstance.toJson(statsOptions);
|
|
2665
2670
|
}
|
|
2666
|
-
function formatStats(stats, hasErrors) {
|
|
2671
|
+
function formatStats(stats, hasErrors, root) {
|
|
2667
2672
|
if (hasErrors) return {
|
|
2668
|
-
message: formatErrorMessage(getStatsErrors(stats).map((item)=>formatStatsError(item))),
|
|
2673
|
+
message: formatErrorMessage(getStatsErrors(stats).map((item)=>formatStatsError(item, root))),
|
|
2669
2674
|
level: 'error'
|
|
2670
2675
|
};
|
|
2671
|
-
let warningMessages = getStatsWarnings(stats).map((item)=>formatStatsError(item));
|
|
2676
|
+
let warningMessages = getStatsWarnings(stats).map((item)=>formatStatsError(item, root));
|
|
2672
2677
|
if (warningMessages.length) {
|
|
2673
2678
|
let title = color.bold(color.yellow(warningMessages.length > 1 ? 'Build warnings: \n' : 'Build warning: \n'));
|
|
2674
2679
|
return {
|
|
@@ -2930,7 +2935,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2930
2935
|
port: '',
|
|
2931
2936
|
host: '',
|
|
2932
2937
|
overlay: !0,
|
|
2933
|
-
reconnect: 100
|
|
2938
|
+
reconnect: 100,
|
|
2939
|
+
logLevel: 'info'
|
|
2934
2940
|
}
|
|
2935
2941
|
},
|
|
2936
2942
|
server: {
|
|
@@ -3052,7 +3058,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3052
3058
|
strategy: 'split-by-experience'
|
|
3053
3059
|
}
|
|
3054
3060
|
},
|
|
3055
|
-
environments: {}
|
|
3061
|
+
environments: {},
|
|
3062
|
+
logLevel: 'info'
|
|
3056
3063
|
});
|
|
3057
3064
|
function getDefaultEntry(root) {
|
|
3058
3065
|
let entryFile = findExists([
|
|
@@ -3071,7 +3078,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3071
3078
|
}
|
|
3072
3079
|
let withDefaultConfig = async (rootPath, config)=>{
|
|
3073
3080
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
3074
|
-
if (merged.root ||= rootPath, merged.source ||= {}, merged.server?.base && (config.dev?.assetPrefix === void 0 && (merged.dev ||= {}, merged.dev.assetPrefix = merged.server.base), config.output?.assetPrefix === void 0 && (merged.output ||= {}, merged.output.assetPrefix = merged.server.base)), merged.dev?.lazyCompilation === void 0 && (merged.dev ||= {}, merged.dev.lazyCompilation = {
|
|
3081
|
+
if (merged.root ||= rootPath, merged.source ||= {}, merged.server?.base && (config.dev?.assetPrefix === void 0 && (merged.dev ||= {}, merged.dev.assetPrefix = merged.server.base), config.output?.assetPrefix === void 0 && (merged.output ||= {}, merged.output.assetPrefix = merged.server.base)), config.dev?.client?.logLevel === void 0 && (merged.dev ||= {}, merged.dev.client ||= {}, merged.dev.client.logLevel = merged.logLevel), merged.dev?.lazyCompilation === void 0 && (merged.dev ||= {}, merged.dev.lazyCompilation = {
|
|
3075
3082
|
imports: !0,
|
|
3076
3083
|
entries: !1
|
|
3077
3084
|
}), !merged.source.tsconfigPath) {
|
|
@@ -3548,7 +3555,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3548
3555
|
async function createContext(options, userConfig) {
|
|
3549
3556
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
3550
3557
|
return {
|
|
3551
|
-
version: "1.6.
|
|
3558
|
+
version: "1.6.14",
|
|
3552
3559
|
rootPath,
|
|
3553
3560
|
distPath: '',
|
|
3554
3561
|
cachePath,
|
|
@@ -4132,7 +4139,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4132
4139
|
}), compiler.hooks.done.tap(HOOK_NAME, (statsInstance)=>{
|
|
4133
4140
|
let stats = getRsbuildStats(statsInstance, compiler, context.action), hasErrors = statsInstance.hasErrors();
|
|
4134
4141
|
context.buildState.stats = stats, context.buildState.status = 'done', context.buildState.hasErrors = hasErrors, context.socketServer?.onBuildDone();
|
|
4135
|
-
let { message, level } = formatStats(stats, hasErrors);
|
|
4142
|
+
let { message, level } = formatStats(stats, hasErrors, options.context.rootPath);
|
|
4136
4143
|
'error' === level && logger.error(message), 'warning' === level && logger.warn(message), isMultiCompiler || printTime(0, hasErrors), isCompiling = !1;
|
|
4137
4144
|
}), 'dev' === context.action && registerDevHook({
|
|
4138
4145
|
context,
|
|
@@ -4230,7 +4237,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4230
4237
|
rawPublicVars
|
|
4231
4238
|
};
|
|
4232
4239
|
}
|
|
4233
|
-
var external_node_util_ = __webpack_require__("node:util");
|
|
4234
4240
|
let chainStaticAssetRule = ({ emit, rule, maxSize, filename, assetType })=>{
|
|
4235
4241
|
let generatorOptions = {
|
|
4236
4242
|
filename
|
|
@@ -4457,7 +4463,36 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4457
4463
|
let data = await fileSize_gzip(input);
|
|
4458
4464
|
return Buffer.byteLength(data);
|
|
4459
4465
|
}
|
|
4460
|
-
|
|
4466
|
+
function getSnapshotPath(dir, snapshotHash) {
|
|
4467
|
+
return snapshotHash ? external_node_path_default().join(dir, `rsbuild/file-sizes-${snapshotHash}.json`) : external_node_path_default().join(dir, 'rsbuild/file-sizes.json');
|
|
4468
|
+
}
|
|
4469
|
+
function normalizeFilename(fileName) {
|
|
4470
|
+
return fileName.replace(/\.[a-f0-9]{8,}\./g, '.');
|
|
4471
|
+
}
|
|
4472
|
+
async function loadPrevSnapshots(snapshotPath) {
|
|
4473
|
+
try {
|
|
4474
|
+
let content = await external_node_fs_default().promises.readFile(snapshotPath, 'utf-8');
|
|
4475
|
+
return JSON.parse(content);
|
|
4476
|
+
} catch {
|
|
4477
|
+
return null;
|
|
4478
|
+
}
|
|
4479
|
+
}
|
|
4480
|
+
async function saveSnapshots(snapshotPath, snapshots) {
|
|
4481
|
+
try {
|
|
4482
|
+
await external_node_fs_default().promises.mkdir(external_node_path_default().dirname(snapshotPath), {
|
|
4483
|
+
recursive: !0
|
|
4484
|
+
}), await external_node_fs_default().promises.writeFile(snapshotPath, JSON.stringify(snapshots, null, 2));
|
|
4485
|
+
} catch (err) {
|
|
4486
|
+
logger.debug('Failed to save file size snapshots:', err);
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), isSignificantDiff = (diff)=>Math.abs(diff) >= 10, formatDiff = (diff)=>{
|
|
4490
|
+
let label = `(${diff > 0 ? '+' : '-'}${calcFileSize(Math.abs(diff))})`;
|
|
4491
|
+
return {
|
|
4492
|
+
label: (diff > 0 ? color.red : color.green)(label),
|
|
4493
|
+
length: label.length
|
|
4494
|
+
};
|
|
4495
|
+
}, getAssetColor = (size)=>size > 300000 ? color.red : size > 100000 ? color.yellow : color.green;
|
|
4461
4496
|
function getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
|
|
4462
4497
|
let lengths = [
|
|
4463
4498
|
maxFileLength,
|
|
@@ -4476,26 +4511,83 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4476
4511
|
let calcFileSize = (len)=>{
|
|
4477
4512
|
let val = len / 1000;
|
|
4478
4513
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
4479
|
-
},
|
|
4480
|
-
async function printFileSizes(options, stats, rootPath, distPath, environmentName) {
|
|
4481
|
-
let logs = [], showDetail = !1 !== options.detail, showTotal = !1 !== options.total;
|
|
4482
|
-
if (!showTotal && !showDetail) return
|
|
4483
|
-
|
|
4484
|
-
|
|
4514
|
+
}, COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i;
|
|
4515
|
+
async function printFileSizes(options, stats, rootPath, distPath, environmentName, previousSizes) {
|
|
4516
|
+
let logs = [], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, showTotal = !1 !== options.total;
|
|
4517
|
+
if (!showTotal && !showDetail) return {
|
|
4518
|
+
logs
|
|
4519
|
+
};
|
|
4520
|
+
let relativeDistPath = external_node_path_default().relative(rootPath, distPath), snapshot = {
|
|
4521
|
+
files: {},
|
|
4522
|
+
totalSize: 0,
|
|
4523
|
+
totalGzipSize: 0
|
|
4524
|
+
}, formatAsset = async (asset)=>{
|
|
4525
|
+
var assetName;
|
|
4526
|
+
let assetName1, fileName = asset.name.split('?')[0], contents = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, fileName)), size = Buffer.byteLength(contents), gzippedSize = options.compressed && (assetName1 = fileName, COMPRESSIBLE_REGEX.test(assetName1)) ? await gzipSize(contents) : null, normalizedName = normalizeFilename(fileName);
|
|
4527
|
+
snapshot.files[normalizedName] = {
|
|
4528
|
+
size,
|
|
4529
|
+
gzippedSize: gzippedSize ?? void 0
|
|
4530
|
+
};
|
|
4531
|
+
let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
|
|
4532
|
+
if (showDiff) {
|
|
4533
|
+
let sizeData = previousSizes[environmentName]?.files[normalizedName], sizeDiff = size - (sizeData?.size ?? 0);
|
|
4534
|
+
if (isSignificantDiff(sizeDiff)) {
|
|
4535
|
+
let { label, length } = formatDiff(sizeDiff);
|
|
4536
|
+
sizeLabel += ` ${label}`, sizeLabelLength += length + 1;
|
|
4537
|
+
}
|
|
4538
|
+
if (null !== gzippedSize) {
|
|
4539
|
+
let gzipDiff = gzippedSize - (sizeData?.gzippedSize ?? 0);
|
|
4540
|
+
isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
4543
|
+
let folder = external_node_path_default().join(relativeDistPath, external_node_path_default().dirname(fileName)), name = external_node_path_default().basename(fileName), filenameLabel = color.dim(folder + external_node_path_default().sep) + (assetName = name, JS_REGEX.test(assetName) ? color.cyan(assetName) : assetName.endsWith('.css') ? color.yellow(assetName) : assetName.endsWith('.html') ? color.green(assetName) : color.magenta(assetName)), filenameLength = (folder + external_node_path_default().sep + name).length;
|
|
4485
4544
|
return {
|
|
4545
|
+
name,
|
|
4546
|
+
filenameLabel,
|
|
4547
|
+
filenameLength,
|
|
4486
4548
|
size,
|
|
4487
|
-
|
|
4488
|
-
|
|
4549
|
+
sizeLabel,
|
|
4550
|
+
sizeLabelLength,
|
|
4489
4551
|
gzippedSize,
|
|
4490
|
-
sizeLabel: calcFileSize(size),
|
|
4491
4552
|
gzipSizeLabel
|
|
4492
4553
|
};
|
|
4493
|
-
}, getAssets = async ()=>
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4554
|
+
}, getAssets = async ()=>{
|
|
4555
|
+
let assets = getAssetsFromStats(stats), exclude = options.exclude ?? excludeAsset, filteredAssets = assets.filter((asset)=>!exclude(asset) && (!options.include || options.include(asset)));
|
|
4556
|
+
return (await Promise.all(filteredAssets.map((asset)=>formatAsset(asset)))).sort((a, b)=>a.size - b.size);
|
|
4557
|
+
}, assets = await getAssets();
|
|
4558
|
+
if (0 === assets.length) return {
|
|
4559
|
+
logs
|
|
4560
|
+
};
|
|
4561
|
+
logs.push(''), showDetail && 1 === assets.length && (showTotal = !1);
|
|
4562
|
+
let { totalSize, totalGzipSize } = ((assets, compressed)=>{
|
|
4563
|
+
let totalSize = 0, totalGzipSize = 0;
|
|
4564
|
+
for (let { size, gzippedSize } of assets)totalSize += size, compressed && (totalGzipSize += gzippedSize ?? size);
|
|
4565
|
+
return {
|
|
4566
|
+
totalSize,
|
|
4567
|
+
totalGzipSize
|
|
4568
|
+
};
|
|
4569
|
+
})(assets, options.compressed);
|
|
4570
|
+
snapshot.totalSize = totalSize, snapshot.totalGzipSize = totalGzipSize;
|
|
4571
|
+
let fileHeader = showDetail ? `File (${environmentName})` : '', { totalSizeTitle, totalSizeLabel, totalSizeLabelLength } = (()=>{
|
|
4572
|
+
if (!showTotal) return {
|
|
4573
|
+
totalSizeTitle: '',
|
|
4574
|
+
totalSizeLabel: '',
|
|
4575
|
+
totalSizeLabelLength: 0
|
|
4576
|
+
};
|
|
4577
|
+
let totalSizeTitle = showDetail ? 'Total:' : `Total size (${environmentName}):`, totalSizeLabel = calcFileSize(totalSize), totalSizeLabelLength = totalSizeLabel.length;
|
|
4578
|
+
if (showDiff) {
|
|
4579
|
+
let totalSizeDiff = totalSize - (previousSizes[environmentName]?.totalSize ?? 0);
|
|
4580
|
+
if (isSignificantDiff(totalSizeDiff)) {
|
|
4581
|
+
let { label, length } = formatDiff(totalSizeDiff);
|
|
4582
|
+
totalSizeLabel += ` ${label}`, totalSizeLabelLength += length + 1;
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
return {
|
|
4586
|
+
totalSizeTitle,
|
|
4587
|
+
totalSizeLabel,
|
|
4588
|
+
totalSizeLabelLength
|
|
4589
|
+
};
|
|
4590
|
+
})(), getCustomTotal = ()=>'function' == typeof options.total ? options.total({
|
|
4499
4591
|
environmentName,
|
|
4500
4592
|
distPath: relativeDistPath,
|
|
4501
4593
|
assets: assets.map((asset)=>{
|
|
@@ -4509,13 +4601,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4509
4601
|
totalGzipSize
|
|
4510
4602
|
}) : null;
|
|
4511
4603
|
if (showDetail) {
|
|
4512
|
-
let maxFileLength = Math.max(...assets.map((
|
|
4604
|
+
let maxFileLength = Math.max(...assets.map((asset)=>asset.filenameLength), showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = Math.max(...assets.map((a)=>a.sizeLabelLength), totalSizeLabelLength), showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
|
|
4513
4605
|
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
|
|
4514
|
-
let { sizeLabel } = asset, {
|
|
4515
|
-
|
|
4516
|
-
let
|
|
4517
|
-
fileNameLength < maxFileLength && (fileNameLabel += ' '.repeat(maxFileLength - fileNameLength));
|
|
4518
|
-
let log = `${fileNameLabel} ${sizeLabel}`;
|
|
4606
|
+
let { sizeLabel, sizeLabelLength, gzipSizeLabel } = asset, { filenameLength } = asset, { filenameLabel } = asset;
|
|
4607
|
+
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
|
|
4608
|
+
let log = `${filenameLabel} ${sizeLabel}`;
|
|
4519
4609
|
gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
|
|
4520
4610
|
}
|
|
4521
4611
|
if (showTotal) {
|
|
@@ -4524,9 +4614,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4524
4614
|
if (customTotal) logs.push(customTotal);
|
|
4525
4615
|
else {
|
|
4526
4616
|
let log = '';
|
|
4527
|
-
if (log += ' '.repeat(maxFileLength -
|
|
4617
|
+
if (log += ' '.repeat(maxFileLength - totalSizeTitle.length), log += color.magenta(totalSizeTitle), log += ` ${totalSizeLabel}`, options.compressed) {
|
|
4528
4618
|
let colorFn = getAssetColor(totalGzipSize / assets.length);
|
|
4529
|
-
log += ' '.repeat(maxSizeLength -
|
|
4619
|
+
if (log += ' '.repeat(maxSizeLength - totalSizeLabelLength), log += ` ${colorFn(calcFileSize(totalGzipSize))}`, showDiff) {
|
|
4620
|
+
let totalGzipSizeDiff = totalGzipSize - (previousSizes[environmentName]?.totalGzipSize ?? 0);
|
|
4621
|
+
isSignificantDiff(totalGzipSizeDiff) && (log += ` ${formatDiff(totalGzipSizeDiff).label}`);
|
|
4622
|
+
}
|
|
4530
4623
|
}
|
|
4531
4624
|
logs.push(log);
|
|
4532
4625
|
}
|
|
@@ -4535,11 +4628,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4535
4628
|
let customTotal = getCustomTotal();
|
|
4536
4629
|
if (customTotal) logs.push(customTotal);
|
|
4537
4630
|
else {
|
|
4538
|
-
let log = `${color.magenta(
|
|
4631
|
+
let log = `${color.magenta(totalSizeTitle)} ${totalSizeLabel}`;
|
|
4539
4632
|
options.compressed && (log += color.green(` (${calcFileSize(totalGzipSize)} gzipped)`)), logs.push(log);
|
|
4540
4633
|
}
|
|
4541
4634
|
}
|
|
4542
|
-
return logs.push(''),
|
|
4635
|
+
return logs.push(''), {
|
|
4636
|
+
logs,
|
|
4637
|
+
snapshot
|
|
4638
|
+
};
|
|
4543
4639
|
}
|
|
4544
4640
|
let entryNameSymbol = Symbol('entryName'), VOID_TAGS = [
|
|
4545
4641
|
'area',
|
|
@@ -4931,6 +5027,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4931
5027
|
if ('EADDRINUSE' !== e.code) throw e;
|
|
4932
5028
|
port++, attempts++;
|
|
4933
5029
|
}
|
|
5030
|
+
if (!found) throw Error(`${color.dim('[rsbuild:server]')} Failed to find an available port after ${tryLimits + 1} attempts, starting from ${color.yellow(original)}.`);
|
|
4934
5031
|
if (port !== original && strictPort) throw Error(`${color.dim('[rsbuild:server]')} Port ${color.yellow(original)} is occupied, please choose another one.`);
|
|
4935
5032
|
return port;
|
|
4936
5033
|
}, getServerConfig = async ({ config })=>{
|
|
@@ -5886,7 +5983,8 @@ init({
|
|
|
5886
5983
|
serverHost: ${JSON.stringify(resolvedHost)},
|
|
5887
5984
|
serverPort: ${resolvedPort},
|
|
5888
5985
|
liveReload: ${config.dev.liveReload},
|
|
5889
|
-
browserLogs: ${!!config.dev.browserLogs}
|
|
5986
|
+
browserLogs: ${!!config.dev.browserLogs},
|
|
5987
|
+
logLevel: ${JSON.stringify(config.dev.client.logLevel)}
|
|
5890
5988
|
});
|
|
5891
5989
|
`;
|
|
5892
5990
|
new compiler.webpack.EntryPlugin(compiler.context, createVirtualModule(hmrEntry), {
|
|
@@ -6373,7 +6471,7 @@ init({
|
|
|
6373
6471
|
});
|
|
6374
6472
|
}
|
|
6375
6473
|
sendError(errors, token) {
|
|
6376
|
-
let formattedErrors = errors.map((item)=>formatStatsError(item));
|
|
6474
|
+
let formattedErrors = errors.map((item)=>formatStatsError(item, this.context.rootPath));
|
|
6377
6475
|
this.sockWrite({
|
|
6378
6476
|
type: 'errors',
|
|
6379
6477
|
data: {
|
|
@@ -6383,7 +6481,7 @@ init({
|
|
|
6383
6481
|
}, token);
|
|
6384
6482
|
}
|
|
6385
6483
|
sendWarning(warnings, token) {
|
|
6386
|
-
let formattedWarnings = warnings.map((item)=>formatStatsError(item));
|
|
6484
|
+
let formattedWarnings = warnings.map((item)=>formatStatsError(item, this.context.rootPath));
|
|
6387
6485
|
this.sockWrite({
|
|
6388
6486
|
type: 'warnings',
|
|
6389
6487
|
data: {
|
|
@@ -7827,25 +7925,32 @@ init({
|
|
|
7827
7925
|
(context1 = context, {
|
|
7828
7926
|
name: 'rsbuild:file-size',
|
|
7829
7927
|
setup (api) {
|
|
7830
|
-
api.onAfterBuild(async ({ stats,
|
|
7928
|
+
api.onAfterBuild(async ({ stats, isFirstCompile })=>{
|
|
7831
7929
|
let { hasErrors } = context1.buildState;
|
|
7832
7930
|
if (!stats || hasErrors || !isFirstCompile) return;
|
|
7833
|
-
let
|
|
7834
|
-
|
|
7931
|
+
let environments = context1.environmentList.filter(({ config })=>!1 !== config.performance.printFileSize);
|
|
7932
|
+
if (!environments.length) return;
|
|
7933
|
+
let showDiff = environments.some((environment)=>{
|
|
7835
7934
|
let { printFileSize } = environment.config.performance;
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7935
|
+
return 'object' == typeof printFileSize && !!printFileSize.diff;
|
|
7936
|
+
}), { configFilePath } = api.getNormalizedConfig()._privateMeta || {}, snapshotHash = showDiff && configFilePath ? await helpers_hash(configFilePath) : '', snapshotPath = showDiff ? getSnapshotPath(api.context.cachePath, snapshotHash) : '', prevSnapshots = showDiff ? await loadPrevSnapshots(snapshotPath) : null, nextSnapshots = {}, logs = await Promise.all(environments.map(async ({ name, index, config, distPath })=>{
|
|
7937
|
+
let statsItem = 'stats' in stats ? stats.stats[index] : stats, { logs: sizeLogs, snapshot } = await printFileSizes(((config)=>{
|
|
7938
|
+
let { printFileSize } = config.performance, defaultConfig = {
|
|
7939
|
+
total: !0,
|
|
7940
|
+
detail: !0,
|
|
7941
|
+
diff: !1,
|
|
7942
|
+
compressed: 'node' !== config.output.target
|
|
7943
|
+
};
|
|
7944
|
+
return !0 === printFileSize ? defaultConfig : {
|
|
7945
|
+
...defaultConfig,
|
|
7946
|
+
...printFileSize
|
|
7947
|
+
};
|
|
7948
|
+
})(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots);
|
|
7949
|
+
return snapshot && (nextSnapshots[name] = snapshot), sizeLogs.join('\n');
|
|
7846
7950
|
})).catch((err)=>{
|
|
7847
7951
|
logger.warn('Failed to print file size.'), logger.warn(err);
|
|
7848
|
-
})
|
|
7952
|
+
});
|
|
7953
|
+
logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(snapshotPath, nextSnapshots);
|
|
7849
7954
|
});
|
|
7850
7955
|
}
|
|
7851
7956
|
}),
|
|
@@ -8508,8 +8613,12 @@ try {
|
|
|
8508
8613
|
stage: 'summarize'
|
|
8509
8614
|
}, ({ compiler, compilation })=>{
|
|
8510
8615
|
if (0 === inlinedAssets.size) return;
|
|
8511
|
-
let { devtool } = compiler.options;
|
|
8512
|
-
for (let name of inlinedAssets)
|
|
8616
|
+
let { devtool } = compiler.options, hasSourceMap = 'hidden-source-map' !== devtool && !1 !== devtool;
|
|
8617
|
+
for (let name of inlinedAssets)hasSourceMap && compilation.updateAsset(name, compilation.assets[name], {
|
|
8618
|
+
related: {
|
|
8619
|
+
sourceMap: null
|
|
8620
|
+
}
|
|
8621
|
+
}), compilation.deleteAsset(name);
|
|
8513
8622
|
inlinedAssets.clear();
|
|
8514
8623
|
}), api.modifyHTMLTags(({ headTags, bodyTags }, { compiler, compilation, environment })=>{
|
|
8515
8624
|
let { htmlPaths, config } = environment;
|
|
@@ -9192,7 +9301,7 @@ try {
|
|
|
9192
9301
|
};
|
|
9193
9302
|
function setupCommands() {
|
|
9194
9303
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9195
|
-
cli.version("1.6.
|
|
9304
|
+
cli.version("1.6.14"), 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)', {
|
|
9196
9305
|
default: 'auto'
|
|
9197
9306
|
}).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', {
|
|
9198
9307
|
type: [
|
|
@@ -9261,7 +9370,7 @@ try {
|
|
|
9261
9370
|
}
|
|
9262
9371
|
function showGreeting() {
|
|
9263
9372
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9264
|
-
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.
|
|
9373
|
+
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.14\n`);
|
|
9265
9374
|
}
|
|
9266
9375
|
function setupLogLevel() {
|
|
9267
9376
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9282,7 +9391,7 @@ try {
|
|
|
9282
9391
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
9283
9392
|
}
|
|
9284
9393
|
}
|
|
9285
|
-
let src_version = "1.6.
|
|
9394
|
+
let src_version = "1.6.14";
|
|
9286
9395
|
})(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
|
|
9287
9396
|
"PLUGIN_CSS_NAME",
|
|
9288
9397
|
"PLUGIN_SWC_NAME",
|
|
@@ -9297,7 +9406,7 @@ try {
|
|
|
9297
9406
|
"rspack",
|
|
9298
9407
|
"runCLI",
|
|
9299
9408
|
"version"
|
|
9300
|
-
].indexOf(
|
|
9409
|
+
].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
|
|
9301
9410
|
Object.defineProperty(exports, '__esModule', {
|
|
9302
9411
|
value: !0
|
|
9303
9412
|
});
|