@rsbuild/core 1.6.12-canary-20251204065915 → 1.6.13
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/131.js +93 -51
- 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 +94 -51
- package/dist-types/client/hmr.d.ts +3 -2
- package/dist-types/client/log.d.ts +13 -0
- package/dist-types/plugins/fileSize.d.ts +2 -2
- package/dist-types/types/config.d.ts +5 -0
- package/package.json +2 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
7653: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(5551);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(218).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
5551: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports["default"] = loader;
|
|
14
14
|
var _postcss = _interopRequireDefault(__nccwpck_require__(1259));
|
|
15
|
-
var _plugins = __nccwpck_require__(
|
|
16
|
-
var _utils = __nccwpck_require__(
|
|
15
|
+
var _plugins = __nccwpck_require__(6644);
|
|
16
|
+
var _utils = __nccwpck_require__(218);
|
|
17
17
|
function _interopRequireDefault(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
19
19
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
6644: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
240
240
|
"use strict";
|
|
241
241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
242
242
|
Object.defineProperty(exports, "icssParser", {
|
|
@@ -258,22 +258,22 @@
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
var _postcssImportParser = _interopRequireDefault(
|
|
261
|
-
__nccwpck_require__(
|
|
261
|
+
__nccwpck_require__(3439),
|
|
262
262
|
);
|
|
263
263
|
var _postcssIcssParser = _interopRequireDefault(
|
|
264
|
-
__nccwpck_require__(
|
|
264
|
+
__nccwpck_require__(8018),
|
|
265
265
|
);
|
|
266
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
266
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(5477));
|
|
267
267
|
function _interopRequireDefault(obj) {
|
|
268
268
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
|
|
271
|
+
8018: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
272
272
|
"use strict";
|
|
273
273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
274
274
|
exports["default"] = void 0;
|
|
275
275
|
var _icssUtils = __nccwpck_require__(229);
|
|
276
|
-
var _utils = __nccwpck_require__(
|
|
276
|
+
var _utils = __nccwpck_require__(218);
|
|
277
277
|
const plugin = (options = {}) => ({
|
|
278
278
|
postcssPlugin: "postcss-icss-parser",
|
|
279
279
|
async OnceExit(root) {
|
|
@@ -372,14 +372,14 @@
|
|
|
372
372
|
plugin.postcss = true;
|
|
373
373
|
var _default = (exports["default"] = plugin);
|
|
374
374
|
},
|
|
375
|
-
|
|
375
|
+
3439: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
376
376
|
"use strict";
|
|
377
377
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
378
378
|
exports["default"] = void 0;
|
|
379
379
|
var _postcssValueParser = _interopRequireDefault(
|
|
380
380
|
__nccwpck_require__(5245),
|
|
381
381
|
);
|
|
382
|
-
var _utils = __nccwpck_require__(
|
|
382
|
+
var _utils = __nccwpck_require__(218);
|
|
383
383
|
function _interopRequireDefault(obj) {
|
|
384
384
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
385
385
|
}
|
|
@@ -684,14 +684,14 @@
|
|
|
684
684
|
plugin.postcss = true;
|
|
685
685
|
var _default = (exports["default"] = plugin);
|
|
686
686
|
},
|
|
687
|
-
|
|
687
|
+
5477: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
688
688
|
"use strict";
|
|
689
689
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
690
690
|
exports["default"] = void 0;
|
|
691
691
|
var _postcssValueParser = _interopRequireDefault(
|
|
692
692
|
__nccwpck_require__(5245),
|
|
693
693
|
);
|
|
694
|
-
var _utils = __nccwpck_require__(
|
|
694
|
+
var _utils = __nccwpck_require__(218);
|
|
695
695
|
function _interopRequireDefault(obj) {
|
|
696
696
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
697
697
|
}
|
|
@@ -1034,7 +1034,7 @@
|
|
|
1034
1034
|
plugin.postcss = true;
|
|
1035
1035
|
var _default = (exports["default"] = plugin);
|
|
1036
1036
|
},
|
|
1037
|
-
|
|
1037
|
+
218: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1038
1038
|
"use strict";
|
|
1039
1039
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1040
1040
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -8098,6 +8098,6 @@
|
|
|
8098
8098
|
}
|
|
8099
8099
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
8100
8100
|
__nccwpck_require__.ab = __dirname + "/";
|
|
8101
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
8101
|
+
var __webpack_exports__ = __nccwpck_require__(7653);
|
|
8102
8102
|
module.exports = __webpack_exports__;
|
|
8103
8103
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
559: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(404);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
}
|
|
312
312
|
module.exports = { CachedChildCompilation };
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
404: (module) => {
|
|
315
315
|
"use strict";
|
|
316
316
|
class HtmlWebpackChildCompiler {
|
|
317
317
|
constructor(templates) {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
940: (module) => {
|
|
484
484
|
"use strict";
|
|
485
485
|
module.exports = {};
|
|
486
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
module.exports.auto = module.exports.none;
|
|
501
501
|
},
|
|
502
|
-
|
|
502
|
+
507: (module) => {
|
|
503
503
|
"use strict";
|
|
504
504
|
module.exports = function (err) {
|
|
505
505
|
return {
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
};
|
|
521
521
|
};
|
|
522
522
|
},
|
|
523
|
-
|
|
523
|
+
786: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
524
524
|
"use strict";
|
|
525
525
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
526
526
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -546,7 +546,7 @@
|
|
|
546
546
|
}
|
|
547
547
|
module.exports = { getHtmlRspackPluginHooks };
|
|
548
548
|
},
|
|
549
|
-
|
|
549
|
+
959: (module) => {
|
|
550
550
|
const voidTags = [
|
|
551
551
|
"area",
|
|
552
552
|
"base",
|
|
@@ -614,19 +614,19 @@
|
|
|
614
614
|
htmlTagObjectToString,
|
|
615
615
|
};
|
|
616
616
|
},
|
|
617
|
-
|
|
617
|
+
894: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
618
618
|
"use strict";
|
|
619
619
|
const promisify = __nccwpck_require__(23).promisify;
|
|
620
620
|
const vm = __nccwpck_require__(154);
|
|
621
621
|
const fs = __nccwpck_require__(896);
|
|
622
622
|
const path = __nccwpck_require__(928);
|
|
623
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
623
|
+
const { CachedChildCompilation } = __nccwpck_require__(559);
|
|
624
624
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
625
|
-
__nccwpck_require__(
|
|
626
|
-
const prettyError = __nccwpck_require__(
|
|
627
|
-
const chunkSorter = __nccwpck_require__(
|
|
625
|
+
__nccwpck_require__(959);
|
|
626
|
+
const prettyError = __nccwpck_require__(507);
|
|
627
|
+
const chunkSorter = __nccwpck_require__(940);
|
|
628
628
|
const getHtmlRspackPluginHooks =
|
|
629
|
-
__nccwpck_require__(
|
|
629
|
+
__nccwpck_require__(786).getHtmlRspackPluginHooks;
|
|
630
630
|
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
631
631
|
class HtmlRspackPlugin {
|
|
632
632
|
constructor(userOptions = {}) {
|
|
@@ -1597,6 +1597,6 @@
|
|
|
1597
1597
|
}
|
|
1598
1598
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1599
1599
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1600
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1600
|
+
var __webpack_exports__ = __nccwpck_require__(894);
|
|
1601
1601
|
module.exports = __webpack_exports__;
|
|
1602
1602
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
357: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(127)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
127: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(802);
|
|
13
13
|
function _interopRequireDefault(e) {
|
|
14
14
|
return e && e.__esModule ? e : { default: e };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
802: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -715,6 +715,6 @@
|
|
|
715
715
|
})();
|
|
716
716
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
717
717
|
__nccwpck_require__.ab = __dirname + "/";
|
|
718
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
718
|
+
var __webpack_exports__ = __nccwpck_require__(357);
|
|
719
719
|
module.exports = __webpack_exports__;
|
|
720
720
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
38: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
935: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const node_fs_1 = __nccwpck_require__(24);
|
|
131
131
|
const node_path_1 = __nccwpck_require__(760);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(38);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
exports.getCompilerHooks =
|
|
328
328
|
void 0;
|
|
329
329
|
const node_path_1 = __nccwpck_require__(760);
|
|
330
|
-
const hooks_1 = __nccwpck_require__(
|
|
330
|
+
const hooks_1 = __nccwpck_require__(935);
|
|
331
331
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
332
332
|
enumerable: true,
|
|
333
333
|
get: function () {
|
package/dist/131.js
CHANGED
|
@@ -2826,7 +2826,8 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2826
2826
|
port: '',
|
|
2827
2827
|
host: '',
|
|
2828
2828
|
overlay: !0,
|
|
2829
|
-
reconnect: 100
|
|
2829
|
+
reconnect: 100,
|
|
2830
|
+
logLevel: 'info'
|
|
2830
2831
|
}
|
|
2831
2832
|
},
|
|
2832
2833
|
server: {
|
|
@@ -2948,7 +2949,8 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2948
2949
|
strategy: 'split-by-experience'
|
|
2949
2950
|
}
|
|
2950
2951
|
},
|
|
2951
|
-
environments: {}
|
|
2952
|
+
environments: {},
|
|
2953
|
+
logLevel: 'info'
|
|
2952
2954
|
});
|
|
2953
2955
|
function getDefaultEntry(root) {
|
|
2954
2956
|
let entryFile = findExists([
|
|
@@ -2967,7 +2969,7 @@ function getDefaultEntry(root) {
|
|
|
2967
2969
|
}
|
|
2968
2970
|
let withDefaultConfig = async (rootPath, config)=>{
|
|
2969
2971
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
2970
|
-
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 = {
|
|
2972
|
+
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 = {
|
|
2971
2973
|
imports: !0,
|
|
2972
2974
|
entries: !1
|
|
2973
2975
|
}), !merged.source.tsconfigPath) {
|
|
@@ -3418,7 +3420,7 @@ function createPublicContext(context) {
|
|
|
3418
3420
|
async function createContext(options, userConfig) {
|
|
3419
3421
|
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';
|
|
3420
3422
|
return {
|
|
3421
|
-
version: "1.6.
|
|
3423
|
+
version: "1.6.13",
|
|
3422
3424
|
rootPath,
|
|
3423
3425
|
distPath: '',
|
|
3424
3426
|
cachePath,
|
|
@@ -4337,14 +4339,13 @@ async function gzipSize(input) {
|
|
|
4337
4339
|
let data = await fileSize_gzip(input);
|
|
4338
4340
|
return Buffer.byteLength(data);
|
|
4339
4341
|
}
|
|
4340
|
-
function getSnapshotPath(dir) {
|
|
4341
|
-
return external_node_path_.default.join(dir, 'rsbuild/file-sizes.json');
|
|
4342
|
+
function getSnapshotPath(dir, snapshotHash) {
|
|
4343
|
+
return snapshotHash ? external_node_path_.default.join(dir, `rsbuild/file-sizes-${snapshotHash}.json`) : external_node_path_.default.join(dir, 'rsbuild/file-sizes.json');
|
|
4342
4344
|
}
|
|
4343
|
-
function
|
|
4345
|
+
function normalizeFilename(fileName) {
|
|
4344
4346
|
return fileName.replace(/\.[a-f0-9]{8,}\./g, '.');
|
|
4345
4347
|
}
|
|
4346
|
-
async function
|
|
4347
|
-
let snapshotPath = getSnapshotPath(dir);
|
|
4348
|
+
async function loadPrevSnapshots(snapshotPath) {
|
|
4348
4349
|
try {
|
|
4349
4350
|
let content = await node_fs.promises.readFile(snapshotPath, 'utf-8');
|
|
4350
4351
|
return JSON.parse(content);
|
|
@@ -4352,8 +4353,7 @@ async function loadPreviousSizes(dir) {
|
|
|
4352
4353
|
return null;
|
|
4353
4354
|
}
|
|
4354
4355
|
}
|
|
4355
|
-
async function saveSnapshots(
|
|
4356
|
-
let snapshotPath = getSnapshotPath(dir);
|
|
4356
|
+
async function saveSnapshots(snapshotPath, snapshots) {
|
|
4357
4357
|
try {
|
|
4358
4358
|
await node_fs.promises.mkdir(external_node_path_.default.dirname(snapshotPath), {
|
|
4359
4359
|
recursive: !0
|
|
@@ -4362,7 +4362,7 @@ async function saveSnapshots(dir, snapshots) {
|
|
|
4362
4362
|
logger.debug('Failed to save file size snapshots:', err);
|
|
4363
4363
|
}
|
|
4364
4364
|
}
|
|
4365
|
-
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), formatDiff = (diff)=>{
|
|
4365
|
+
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)=>{
|
|
4366
4366
|
let label = `(${diff > 0 ? '+' : '-'}${calcFileSize(Math.abs(diff))})`;
|
|
4367
4367
|
return {
|
|
4368
4368
|
label: (diff > 0 ? color.red : color.green)(label),
|
|
@@ -4387,47 +4387,82 @@ function getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
|
|
|
4387
4387
|
let calcFileSize = (len)=>{
|
|
4388
4388
|
let val = len / 1000;
|
|
4389
4389
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
4390
|
-
},
|
|
4390
|
+
}, COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i;
|
|
4391
4391
|
async function printFileSizes(options, stats, rootPath, distPath, environmentName, previousSizes) {
|
|
4392
4392
|
let logs = [], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, showTotal = !1 !== options.total;
|
|
4393
4393
|
if (!showTotal && !showDetail) return {
|
|
4394
4394
|
logs
|
|
4395
4395
|
};
|
|
4396
|
-
let
|
|
4397
|
-
|
|
4398
|
-
|
|
4396
|
+
let relativeDistPath = external_node_path_.default.relative(rootPath, distPath), snapshot = {
|
|
4397
|
+
files: {},
|
|
4398
|
+
totalSize: 0,
|
|
4399
|
+
totalGzipSize: 0
|
|
4400
|
+
}, formatAsset = async (asset)=>{
|
|
4401
|
+
let fileName = asset.name.split('?')[0], contents = await node_fs.promises.readFile(external_node_path_.default.join(distPath, fileName)), size = Buffer.byteLength(contents), gzippedSize = options.compressed && COMPRESSIBLE_REGEX.test(fileName) ? await gzipSize(contents) : null, normalizedName = normalizeFilename(fileName);
|
|
4402
|
+
snapshot.files[normalizedName] = {
|
|
4399
4403
|
size,
|
|
4400
4404
|
gzippedSize: gzippedSize ?? void 0
|
|
4401
4405
|
};
|
|
4402
4406
|
let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
|
|
4403
4407
|
if (showDiff) {
|
|
4404
|
-
let sizeData = previousSizes[environmentName]?.[normalizedName], sizeDiff = size - (sizeData?.size ?? 0);
|
|
4405
|
-
if (
|
|
4408
|
+
let sizeData = previousSizes[environmentName]?.files[normalizedName], sizeDiff = size - (sizeData?.size ?? 0);
|
|
4409
|
+
if (isSignificantDiff(sizeDiff)) {
|
|
4406
4410
|
let { label, length } = formatDiff(sizeDiff);
|
|
4407
4411
|
sizeLabel += ` ${label}`, sizeLabelLength += length + 1;
|
|
4408
4412
|
}
|
|
4409
|
-
if (gzippedSize) {
|
|
4413
|
+
if (null !== gzippedSize) {
|
|
4410
4414
|
let gzipDiff = gzippedSize - (sizeData?.gzippedSize ?? 0);
|
|
4411
|
-
|
|
4415
|
+
isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
|
|
4412
4416
|
}
|
|
4413
4417
|
}
|
|
4418
|
+
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) + (JS_REGEX.test(name) ? color.cyan(name) : name.endsWith('.css') ? color.yellow(name) : name.endsWith('.html') ? color.green(name) : color.magenta(name)), filenameLength = (folder + external_node_path_.default.sep + name).length;
|
|
4414
4419
|
return {
|
|
4420
|
+
name,
|
|
4421
|
+
filenameLabel,
|
|
4422
|
+
filenameLength,
|
|
4415
4423
|
size,
|
|
4416
4424
|
sizeLabel,
|
|
4417
4425
|
sizeLabelLength,
|
|
4418
|
-
folder: external_node_path_.default.join(relativeDistPath, external_node_path_.default.dirname(fileName)),
|
|
4419
|
-
name: external_node_path_.default.basename(fileName),
|
|
4420
4426
|
gzippedSize,
|
|
4421
4427
|
gzipSizeLabel
|
|
4422
4428
|
};
|
|
4423
|
-
}, getAssets = async ()=>
|
|
4429
|
+
}, getAssets = async ()=>{
|
|
4430
|
+
let assets = getAssetsFromStats(stats), exclude = options.exclude ?? excludeAsset, filteredAssets = assets.filter((asset)=>!exclude(asset) && (!options.include || options.include(asset)));
|
|
4431
|
+
return (await Promise.all(filteredAssets.map((asset)=>formatAsset(asset)))).sort((a, b)=>a.size - b.size);
|
|
4432
|
+
}, assets = await getAssets();
|
|
4424
4433
|
if (0 === assets.length) return {
|
|
4425
4434
|
logs
|
|
4426
4435
|
};
|
|
4427
|
-
logs.push(''), assets.
|
|
4428
|
-
let totalSize
|
|
4429
|
-
|
|
4430
|
-
|
|
4436
|
+
logs.push(''), showDetail && 1 === assets.length && (showTotal = !1);
|
|
4437
|
+
let { totalSize, totalGzipSize } = ((assets, compressed)=>{
|
|
4438
|
+
let totalSize = 0, totalGzipSize = 0;
|
|
4439
|
+
for (let { size, gzippedSize } of assets)totalSize += size, compressed && (totalGzipSize += gzippedSize ?? size);
|
|
4440
|
+
return {
|
|
4441
|
+
totalSize,
|
|
4442
|
+
totalGzipSize
|
|
4443
|
+
};
|
|
4444
|
+
})(assets, options.compressed);
|
|
4445
|
+
snapshot.totalSize = totalSize, snapshot.totalGzipSize = totalGzipSize;
|
|
4446
|
+
let fileHeader = showDetail ? `File (${environmentName})` : '', { totalSizeTitle, totalSizeLabel, totalSizeLabelLength } = (()=>{
|
|
4447
|
+
if (!showTotal) return {
|
|
4448
|
+
totalSizeTitle: '',
|
|
4449
|
+
totalSizeLabel: '',
|
|
4450
|
+
totalSizeLabelLength: 0
|
|
4451
|
+
};
|
|
4452
|
+
let totalSizeTitle = showDetail ? 'Total:' : `Total size (${environmentName}):`, totalSizeLabel = calcFileSize(totalSize), totalSizeLabelLength = totalSizeLabel.length;
|
|
4453
|
+
if (showDiff) {
|
|
4454
|
+
let totalSizeDiff = totalSize - (previousSizes[environmentName]?.totalSize ?? 0);
|
|
4455
|
+
if (isSignificantDiff(totalSizeDiff)) {
|
|
4456
|
+
let { label, length } = formatDiff(totalSizeDiff);
|
|
4457
|
+
totalSizeLabel += ` ${label}`, totalSizeLabelLength += length + 1;
|
|
4458
|
+
}
|
|
4459
|
+
}
|
|
4460
|
+
return {
|
|
4461
|
+
totalSizeTitle,
|
|
4462
|
+
totalSizeLabel,
|
|
4463
|
+
totalSizeLabelLength
|
|
4464
|
+
};
|
|
4465
|
+
})(), getCustomTotal = ()=>'function' == typeof options.total ? options.total({
|
|
4431
4466
|
environmentName,
|
|
4432
4467
|
distPath: relativeDistPath,
|
|
4433
4468
|
assets: assets.map((asset)=>({
|
|
@@ -4438,11 +4473,11 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4438
4473
|
totalGzipSize
|
|
4439
4474
|
}) : null;
|
|
4440
4475
|
if (showDetail) {
|
|
4441
|
-
let maxFileLength = Math.max(...assets.map((
|
|
4476
|
+
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));
|
|
4442
4477
|
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
|
|
4443
|
-
let { sizeLabel, sizeLabelLength, gzipSizeLabel } = asset, {
|
|
4444
|
-
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)),
|
|
4445
|
-
let log = `${
|
|
4478
|
+
let { sizeLabel, sizeLabelLength, gzipSizeLabel } = asset, { filenameLength } = asset, { filenameLabel } = asset;
|
|
4479
|
+
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
|
|
4480
|
+
let log = `${filenameLabel} ${sizeLabel}`;
|
|
4446
4481
|
gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
|
|
4447
4482
|
}
|
|
4448
4483
|
if (showTotal) {
|
|
@@ -4451,9 +4486,12 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4451
4486
|
if (customTotal) logs.push(customTotal);
|
|
4452
4487
|
else {
|
|
4453
4488
|
let log = '';
|
|
4454
|
-
if (log += ' '.repeat(maxFileLength -
|
|
4489
|
+
if (log += ' '.repeat(maxFileLength - totalSizeTitle.length), log += color.magenta(totalSizeTitle), log += ` ${totalSizeLabel}`, options.compressed) {
|
|
4455
4490
|
let colorFn = getAssetColor(totalGzipSize / assets.length);
|
|
4456
|
-
log += ' '.repeat(maxSizeLength -
|
|
4491
|
+
if (log += ' '.repeat(maxSizeLength - totalSizeLabelLength), log += ` ${colorFn(calcFileSize(totalGzipSize))}`, showDiff) {
|
|
4492
|
+
let totalGzipSizeDiff = totalGzipSize - (previousSizes[environmentName]?.totalGzipSize ?? 0);
|
|
4493
|
+
0 !== totalGzipSizeDiff && (log += ` ${formatDiff(totalGzipSizeDiff).label}`);
|
|
4494
|
+
}
|
|
4457
4495
|
}
|
|
4458
4496
|
logs.push(log);
|
|
4459
4497
|
}
|
|
@@ -4462,13 +4500,13 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4462
4500
|
let customTotal = getCustomTotal();
|
|
4463
4501
|
if (customTotal) logs.push(customTotal);
|
|
4464
4502
|
else {
|
|
4465
|
-
let log = `${color.magenta(
|
|
4503
|
+
let log = `${color.magenta(totalSizeTitle)} ${totalSizeLabel}`;
|
|
4466
4504
|
options.compressed && (log += color.green(` (${calcFileSize(totalGzipSize)} gzipped)`)), logs.push(log);
|
|
4467
4505
|
}
|
|
4468
4506
|
}
|
|
4469
4507
|
return logs.push(''), {
|
|
4470
4508
|
logs,
|
|
4471
|
-
|
|
4509
|
+
snapshot
|
|
4472
4510
|
};
|
|
4473
4511
|
}
|
|
4474
4512
|
let entryNameSymbol = Symbol('entryName'), VOID_TAGS = [
|
|
@@ -5817,7 +5855,8 @@ init({
|
|
|
5817
5855
|
serverHost: ${JSON.stringify(resolvedHost)},
|
|
5818
5856
|
serverPort: ${resolvedPort},
|
|
5819
5857
|
liveReload: ${config.dev.liveReload},
|
|
5820
|
-
browserLogs: ${!!config.dev.browserLogs}
|
|
5858
|
+
browserLogs: ${!!config.dev.browserLogs},
|
|
5859
|
+
logLevel: ${JSON.stringify(config.dev.client.logLevel)}
|
|
5821
5860
|
});
|
|
5822
5861
|
`;
|
|
5823
5862
|
new compiler.webpack.EntryPlugin(compiler.context, createVirtualModule(hmrEntry), {
|
|
@@ -7759,21 +7798,24 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7759
7798
|
let showDiff = environments.some((environment)=>{
|
|
7760
7799
|
let { printFileSize } = environment.config.performance;
|
|
7761
7800
|
return 'object' == typeof printFileSize && !!printFileSize.diff;
|
|
7762
|
-
}),
|
|
7763
|
-
let
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7801
|
+
}), { 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 })=>{
|
|
7802
|
+
let statsItem = 'stats' in stats ? stats.stats[index] : stats, { logs: sizeLogs, snapshot } = await printFileSizes(((config)=>{
|
|
7803
|
+
let { printFileSize } = config.performance, defaultConfig = {
|
|
7804
|
+
total: !0,
|
|
7805
|
+
detail: !0,
|
|
7806
|
+
diff: !1,
|
|
7807
|
+
compressed: 'node' !== config.output.target
|
|
7808
|
+
};
|
|
7809
|
+
return !0 === printFileSize ? defaultConfig : {
|
|
7810
|
+
...defaultConfig,
|
|
7811
|
+
...printFileSize
|
|
7812
|
+
};
|
|
7813
|
+
})(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots);
|
|
7814
|
+
return snapshot && (nextSnapshots[name] = snapshot), sizeLogs.join('\n');
|
|
7773
7815
|
})).catch((err)=>{
|
|
7774
7816
|
logger.warn('Failed to print file size.'), logger.warn(err);
|
|
7775
7817
|
});
|
|
7776
|
-
logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(
|
|
7818
|
+
logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(snapshotPath, nextSnapshots);
|
|
7777
7819
|
});
|
|
7778
7820
|
}
|
|
7779
7821
|
},
|
|
@@ -9119,7 +9161,7 @@ let applyServerOptions = (command)=>{
|
|
|
9119
9161
|
};
|
|
9120
9162
|
function setupCommands() {
|
|
9121
9163
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9122
|
-
cli.version("1.6.
|
|
9164
|
+
cli.version("1.6.13"), 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)', {
|
|
9123
9165
|
default: 'auto'
|
|
9124
9166
|
}).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', {
|
|
9125
9167
|
type: [
|
|
@@ -9188,7 +9230,7 @@ function initNodeEnv() {
|
|
|
9188
9230
|
}
|
|
9189
9231
|
function showGreeting() {
|
|
9190
9232
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9191
|
-
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.
|
|
9233
|
+
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.13\n`);
|
|
9192
9234
|
}
|
|
9193
9235
|
function setupLogLevel() {
|
|
9194
9236
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9209,7 +9251,7 @@ function runCLI() {
|
|
|
9209
9251
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
9210
9252
|
}
|
|
9211
9253
|
}
|
|
9212
|
-
let src_version = "1.6.
|
|
9254
|
+
let src_version = "1.6.13";
|
|
9213
9255
|
import * as __rspack_external_node_module_ab9f2194 from "node:module";
|
|
9214
9256
|
import { createRequire as __rspack_createRequire } from "node:module";
|
|
9215
9257
|
import * as __rspack_external_node_url_e96de089 from "node:url";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const LOG_LEVEL = {
|
|
2
|
+
silent: -1,
|
|
3
|
+
error: 0,
|
|
4
|
+
warn: 1,
|
|
5
|
+
info: 2
|
|
6
|
+
};
|
|
7
|
+
const logger = {
|
|
8
|
+
level: 'info',
|
|
9
|
+
info (...messages) {
|
|
10
|
+
if (LOG_LEVEL.info > LOG_LEVEL[logger.level]) return;
|
|
11
|
+
console.info(...messages);
|
|
12
|
+
},
|
|
13
|
+
warn (...messages) {
|
|
14
|
+
if (LOG_LEVEL.warn > LOG_LEVEL[logger.level]) return;
|
|
15
|
+
console.warn(...messages);
|
|
16
|
+
},
|
|
17
|
+
error (...messages) {
|
|
18
|
+
if (LOG_LEVEL.error > LOG_LEVEL[logger.level]) return;
|
|
19
|
+
console.error(...messages);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export { logger };
|
package/dist/client/hmr.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { logger } from "./59.js";
|
|
1
2
|
let createOverlay;
|
|
2
3
|
let clearOverlay;
|
|
3
4
|
const registerOverlay = (createFn, clearFn)=>{
|
|
4
5
|
createOverlay = createFn;
|
|
5
6
|
clearOverlay = clearFn;
|
|
6
7
|
};
|
|
7
|
-
function init({ token, config, serverHost, serverPort, liveReload, browserLogs }) {
|
|
8
|
+
function init({ token, config, serverHost, serverPort, liveReload, browserLogs, logLevel }) {
|
|
9
|
+
logger.level = logLevel;
|
|
8
10
|
const queuedMessages = [];
|
|
9
11
|
let lastHash;
|
|
10
12
|
let hasBuildErrors = false;
|
|
@@ -38,24 +40,24 @@ function init({ token, config, serverHost, serverPort, liveReload, browserLogs }
|
|
|
38
40
|
clearBuildErrors();
|
|
39
41
|
for(let i = 0; i < text.length; i++){
|
|
40
42
|
if (5 === i) {
|
|
41
|
-
|
|
43
|
+
logger.warn('[rsbuild] Additional warnings detected. View complete log in terminal for details.');
|
|
42
44
|
break;
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
logger.warn(text[i]);
|
|
45
47
|
}
|
|
46
48
|
tryApplyUpdates();
|
|
47
49
|
}
|
|
48
50
|
function handleErrors({ text, html }) {
|
|
49
51
|
clearBuildErrors();
|
|
50
52
|
hasBuildErrors = true;
|
|
51
|
-
for (const error of text)
|
|
53
|
+
for (const error of text)logger.error(error);
|
|
52
54
|
if (createOverlay) createOverlay(html);
|
|
53
55
|
}
|
|
54
56
|
const shouldUpdate = ()=>lastHash !== __webpack_hash__;
|
|
55
57
|
const handleApplyUpdates = (err, updatedModules)=>{
|
|
56
58
|
const forcedReload = err || !updatedModules;
|
|
57
59
|
if (forcedReload) {
|
|
58
|
-
if (err)
|
|
60
|
+
if (err) logger.error('[rsbuild] HMR update failed, performing full reload:', err);
|
|
59
61
|
reloadPage();
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
@@ -82,7 +84,7 @@ function init({ token, config, serverHost, serverPort, liveReload, browserLogs }
|
|
|
82
84
|
if (isSocketReady()) socket.send(JSON.stringify(data));
|
|
83
85
|
};
|
|
84
86
|
function onOpen() {
|
|
85
|
-
|
|
87
|
+
logger.info('[rsbuild] WebSocket connected.');
|
|
86
88
|
reconnectCount = 0;
|
|
87
89
|
pingIntervalId = setInterval(()=>{
|
|
88
90
|
socketSend({
|
|
@@ -118,10 +120,10 @@ function init({ token, config, serverHost, serverPort, liveReload, browserLogs }
|
|
|
118
120
|
}
|
|
119
121
|
function onClose() {
|
|
120
122
|
if (reconnectCount >= config.reconnect) {
|
|
121
|
-
if (config.reconnect > 0)
|
|
123
|
+
if (config.reconnect > 0) logger.warn('[rsbuild] WebSocket connection failed after maximum retry attempts.');
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
124
|
-
if (0 === reconnectCount)
|
|
126
|
+
if (0 === reconnectCount) logger.info('[rsbuild] WebSocket connection lost. Reconnecting...');
|
|
125
127
|
removeListeners();
|
|
126
128
|
socket = null;
|
|
127
129
|
reconnectCount++;
|
|
@@ -129,7 +131,7 @@ function init({ token, config, serverHost, serverPort, liveReload, browserLogs }
|
|
|
129
131
|
}
|
|
130
132
|
function onSocketError() {
|
|
131
133
|
if (formatURL() !== formatURL(true)) {
|
|
132
|
-
|
|
134
|
+
logger.error('[rsbuild] WebSocket connection failed. Trying direct connection fallback.');
|
|
133
135
|
removeListeners();
|
|
134
136
|
socket = null;
|
|
135
137
|
connect(true);
|
|
@@ -159,7 +161,7 @@ function init({ token, config, serverHost, serverPort, liveReload, browserLogs }
|
|
|
159
161
|
sendError(`Uncaught (in promise) ${message}`, stack);
|
|
160
162
|
}
|
|
161
163
|
function connect(fallback = false) {
|
|
162
|
-
if (0 === reconnectCount)
|
|
164
|
+
if (0 === reconnectCount) logger.info('[rsbuild] WebSocket connecting...');
|
|
163
165
|
const socketUrl = formatURL(fallback);
|
|
164
166
|
socket = new WebSocket(socketUrl);
|
|
165
167
|
socket.addEventListener('open', onOpen);
|
package/dist/client/overlay.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { registerOverlay } from "./hmr.js";
|
|
2
|
+
import { logger } from "./59.js";
|
|
2
3
|
function _define_property(obj, key, value) {
|
|
3
4
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
5
|
value: value,
|
|
@@ -32,7 +33,7 @@ class ErrorOverlay extends HTMLElement {
|
|
|
32
33
|
}).addEventListener('finish', remove);
|
|
33
34
|
else remove();
|
|
34
35
|
});
|
|
35
|
-
if (!this.attachShadow) return void
|
|
36
|
+
if (!this.attachShadow) return void logger.warn('[rsbuild] Error overlay disabled: Shadow DOM not supported in this browser.');
|
|
36
37
|
const root = this.attachShadow({
|
|
37
38
|
mode: 'open'
|
|
38
39
|
});
|
|
@@ -65,4 +66,4 @@ function clearOverlay() {
|
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
if ('undefined' != typeof document) registerOverlay(createOverlay, clearOverlay);
|
|
68
|
-
else
|
|
69
|
+
else logger.info('[rsbuild] Error overlay unavailable: Running in non-browser environment. To suppress this message, set `dev.client.overlay: false` in your configuration.');
|
package/dist/index.cjs
CHANGED
|
@@ -2935,7 +2935,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2935
2935
|
port: '',
|
|
2936
2936
|
host: '',
|
|
2937
2937
|
overlay: !0,
|
|
2938
|
-
reconnect: 100
|
|
2938
|
+
reconnect: 100,
|
|
2939
|
+
logLevel: 'info'
|
|
2939
2940
|
}
|
|
2940
2941
|
},
|
|
2941
2942
|
server: {
|
|
@@ -3057,7 +3058,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3057
3058
|
strategy: 'split-by-experience'
|
|
3058
3059
|
}
|
|
3059
3060
|
},
|
|
3060
|
-
environments: {}
|
|
3061
|
+
environments: {},
|
|
3062
|
+
logLevel: 'info'
|
|
3061
3063
|
});
|
|
3062
3064
|
function getDefaultEntry(root) {
|
|
3063
3065
|
let entryFile = findExists([
|
|
@@ -3076,7 +3078,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3076
3078
|
}
|
|
3077
3079
|
let withDefaultConfig = async (rootPath, config)=>{
|
|
3078
3080
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
3079
|
-
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 = {
|
|
3080
3082
|
imports: !0,
|
|
3081
3083
|
entries: !1
|
|
3082
3084
|
}), !merged.source.tsconfigPath) {
|
|
@@ -3553,7 +3555,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3553
3555
|
async function createContext(options, userConfig) {
|
|
3554
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';
|
|
3555
3557
|
return {
|
|
3556
|
-
version: "1.6.
|
|
3558
|
+
version: "1.6.13",
|
|
3557
3559
|
rootPath,
|
|
3558
3560
|
distPath: '',
|
|
3559
3561
|
cachePath,
|
|
@@ -4461,14 +4463,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4461
4463
|
let data = await fileSize_gzip(input);
|
|
4462
4464
|
return Buffer.byteLength(data);
|
|
4463
4465
|
}
|
|
4464
|
-
function getSnapshotPath(dir) {
|
|
4465
|
-
return external_node_path_default().join(dir, 'rsbuild/file-sizes.json');
|
|
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');
|
|
4466
4468
|
}
|
|
4467
|
-
function
|
|
4469
|
+
function normalizeFilename(fileName) {
|
|
4468
4470
|
return fileName.replace(/\.[a-f0-9]{8,}\./g, '.');
|
|
4469
4471
|
}
|
|
4470
|
-
async function
|
|
4471
|
-
let snapshotPath = getSnapshotPath(dir);
|
|
4472
|
+
async function loadPrevSnapshots(snapshotPath) {
|
|
4472
4473
|
try {
|
|
4473
4474
|
let content = await external_node_fs_default().promises.readFile(snapshotPath, 'utf-8');
|
|
4474
4475
|
return JSON.parse(content);
|
|
@@ -4476,8 +4477,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4476
4477
|
return null;
|
|
4477
4478
|
}
|
|
4478
4479
|
}
|
|
4479
|
-
async function saveSnapshots(
|
|
4480
|
-
let snapshotPath = getSnapshotPath(dir);
|
|
4480
|
+
async function saveSnapshots(snapshotPath, snapshots) {
|
|
4481
4481
|
try {
|
|
4482
4482
|
await external_node_fs_default().promises.mkdir(external_node_path_default().dirname(snapshotPath), {
|
|
4483
4483
|
recursive: !0
|
|
@@ -4486,7 +4486,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4486
4486
|
logger.debug('Failed to save file size snapshots:', err);
|
|
4487
4487
|
}
|
|
4488
4488
|
}
|
|
4489
|
-
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), formatDiff = (diff)=>{
|
|
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
4490
|
let label = `(${diff > 0 ? '+' : '-'}${calcFileSize(Math.abs(diff))})`;
|
|
4491
4491
|
return {
|
|
4492
4492
|
label: (diff > 0 ? color.red : color.green)(label),
|
|
@@ -4511,47 +4511,83 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4511
4511
|
let calcFileSize = (len)=>{
|
|
4512
4512
|
let val = len / 1000;
|
|
4513
4513
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
4514
|
-
},
|
|
4514
|
+
}, COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i;
|
|
4515
4515
|
async function printFileSizes(options, stats, rootPath, distPath, environmentName, previousSizes) {
|
|
4516
4516
|
let logs = [], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, showTotal = !1 !== options.total;
|
|
4517
4517
|
if (!showTotal && !showDetail) return {
|
|
4518
4518
|
logs
|
|
4519
4519
|
};
|
|
4520
|
-
let
|
|
4521
|
-
|
|
4522
|
-
|
|
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] = {
|
|
4523
4528
|
size,
|
|
4524
4529
|
gzippedSize: gzippedSize ?? void 0
|
|
4525
4530
|
};
|
|
4526
4531
|
let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
|
|
4527
4532
|
if (showDiff) {
|
|
4528
|
-
let sizeData = previousSizes[environmentName]?.[normalizedName], sizeDiff = size - (sizeData?.size ?? 0);
|
|
4529
|
-
if (
|
|
4533
|
+
let sizeData = previousSizes[environmentName]?.files[normalizedName], sizeDiff = size - (sizeData?.size ?? 0);
|
|
4534
|
+
if (isSignificantDiff(sizeDiff)) {
|
|
4530
4535
|
let { label, length } = formatDiff(sizeDiff);
|
|
4531
4536
|
sizeLabel += ` ${label}`, sizeLabelLength += length + 1;
|
|
4532
4537
|
}
|
|
4533
|
-
if (gzippedSize) {
|
|
4538
|
+
if (null !== gzippedSize) {
|
|
4534
4539
|
let gzipDiff = gzippedSize - (sizeData?.gzippedSize ?? 0);
|
|
4535
|
-
|
|
4540
|
+
isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
|
|
4536
4541
|
}
|
|
4537
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;
|
|
4538
4544
|
return {
|
|
4545
|
+
name,
|
|
4546
|
+
filenameLabel,
|
|
4547
|
+
filenameLength,
|
|
4539
4548
|
size,
|
|
4540
4549
|
sizeLabel,
|
|
4541
4550
|
sizeLabelLength,
|
|
4542
|
-
folder: external_node_path_default().join(relativeDistPath, external_node_path_default().dirname(fileName)),
|
|
4543
|
-
name: external_node_path_default().basename(fileName),
|
|
4544
4551
|
gzippedSize,
|
|
4545
4552
|
gzipSizeLabel
|
|
4546
4553
|
};
|
|
4547
|
-
}, getAssets = async ()=>
|
|
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();
|
|
4548
4558
|
if (0 === assets.length) return {
|
|
4549
4559
|
logs
|
|
4550
4560
|
};
|
|
4551
|
-
logs.push(''), assets.
|
|
4552
|
-
let totalSize
|
|
4553
|
-
|
|
4554
|
-
|
|
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({
|
|
4555
4591
|
environmentName,
|
|
4556
4592
|
distPath: relativeDistPath,
|
|
4557
4593
|
assets: assets.map((asset)=>{
|
|
@@ -4565,11 +4601,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4565
4601
|
totalGzipSize
|
|
4566
4602
|
}) : null;
|
|
4567
4603
|
if (showDetail) {
|
|
4568
|
-
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));
|
|
4569
4605
|
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
|
|
4570
|
-
let { sizeLabel, sizeLabelLength, gzipSizeLabel } = asset, {
|
|
4571
|
-
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)),
|
|
4572
|
-
let log = `${
|
|
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}`;
|
|
4573
4609
|
gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
|
|
4574
4610
|
}
|
|
4575
4611
|
if (showTotal) {
|
|
@@ -4578,9 +4614,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4578
4614
|
if (customTotal) logs.push(customTotal);
|
|
4579
4615
|
else {
|
|
4580
4616
|
let log = '';
|
|
4581
|
-
if (log += ' '.repeat(maxFileLength -
|
|
4617
|
+
if (log += ' '.repeat(maxFileLength - totalSizeTitle.length), log += color.magenta(totalSizeTitle), log += ` ${totalSizeLabel}`, options.compressed) {
|
|
4582
4618
|
let colorFn = getAssetColor(totalGzipSize / assets.length);
|
|
4583
|
-
log += ' '.repeat(maxSizeLength -
|
|
4619
|
+
if (log += ' '.repeat(maxSizeLength - totalSizeLabelLength), log += ` ${colorFn(calcFileSize(totalGzipSize))}`, showDiff) {
|
|
4620
|
+
let totalGzipSizeDiff = totalGzipSize - (previousSizes[environmentName]?.totalGzipSize ?? 0);
|
|
4621
|
+
0 !== totalGzipSizeDiff && (log += ` ${formatDiff(totalGzipSizeDiff).label}`);
|
|
4622
|
+
}
|
|
4584
4623
|
}
|
|
4585
4624
|
logs.push(log);
|
|
4586
4625
|
}
|
|
@@ -4589,13 +4628,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4589
4628
|
let customTotal = getCustomTotal();
|
|
4590
4629
|
if (customTotal) logs.push(customTotal);
|
|
4591
4630
|
else {
|
|
4592
|
-
let log = `${color.magenta(
|
|
4631
|
+
let log = `${color.magenta(totalSizeTitle)} ${totalSizeLabel}`;
|
|
4593
4632
|
options.compressed && (log += color.green(` (${calcFileSize(totalGzipSize)} gzipped)`)), logs.push(log);
|
|
4594
4633
|
}
|
|
4595
4634
|
}
|
|
4596
4635
|
return logs.push(''), {
|
|
4597
4636
|
logs,
|
|
4598
|
-
|
|
4637
|
+
snapshot
|
|
4599
4638
|
};
|
|
4600
4639
|
}
|
|
4601
4640
|
let entryNameSymbol = Symbol('entryName'), VOID_TAGS = [
|
|
@@ -5943,7 +5982,8 @@ init({
|
|
|
5943
5982
|
serverHost: ${JSON.stringify(resolvedHost)},
|
|
5944
5983
|
serverPort: ${resolvedPort},
|
|
5945
5984
|
liveReload: ${config.dev.liveReload},
|
|
5946
|
-
browserLogs: ${!!config.dev.browserLogs}
|
|
5985
|
+
browserLogs: ${!!config.dev.browserLogs},
|
|
5986
|
+
logLevel: ${JSON.stringify(config.dev.client.logLevel)}
|
|
5947
5987
|
});
|
|
5948
5988
|
`;
|
|
5949
5989
|
new compiler.webpack.EntryPlugin(compiler.context, createVirtualModule(hmrEntry), {
|
|
@@ -7892,21 +7932,24 @@ init({
|
|
|
7892
7932
|
let showDiff = environments.some((environment)=>{
|
|
7893
7933
|
let { printFileSize } = environment.config.performance;
|
|
7894
7934
|
return 'object' == typeof printFileSize && !!printFileSize.diff;
|
|
7895
|
-
}),
|
|
7896
|
-
let
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7935
|
+
}), { 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 })=>{
|
|
7936
|
+
let statsItem = 'stats' in stats ? stats.stats[index] : stats, { logs: sizeLogs, snapshot } = await printFileSizes(((config)=>{
|
|
7937
|
+
let { printFileSize } = config.performance, defaultConfig = {
|
|
7938
|
+
total: !0,
|
|
7939
|
+
detail: !0,
|
|
7940
|
+
diff: !1,
|
|
7941
|
+
compressed: 'node' !== config.output.target
|
|
7942
|
+
};
|
|
7943
|
+
return !0 === printFileSize ? defaultConfig : {
|
|
7944
|
+
...defaultConfig,
|
|
7945
|
+
...printFileSize
|
|
7946
|
+
};
|
|
7947
|
+
})(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots);
|
|
7948
|
+
return snapshot && (nextSnapshots[name] = snapshot), sizeLogs.join('\n');
|
|
7906
7949
|
})).catch((err)=>{
|
|
7907
7950
|
logger.warn('Failed to print file size.'), logger.warn(err);
|
|
7908
7951
|
});
|
|
7909
|
-
logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(
|
|
7952
|
+
logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(snapshotPath, nextSnapshots);
|
|
7910
7953
|
});
|
|
7911
7954
|
}
|
|
7912
7955
|
}),
|
|
@@ -9253,7 +9296,7 @@ try {
|
|
|
9253
9296
|
};
|
|
9254
9297
|
function setupCommands() {
|
|
9255
9298
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9256
|
-
cli.version("1.6.
|
|
9299
|
+
cli.version("1.6.13"), 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)', {
|
|
9257
9300
|
default: 'auto'
|
|
9258
9301
|
}).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', {
|
|
9259
9302
|
type: [
|
|
@@ -9322,7 +9365,7 @@ try {
|
|
|
9322
9365
|
}
|
|
9323
9366
|
function showGreeting() {
|
|
9324
9367
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9325
|
-
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.
|
|
9368
|
+
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.13\n`);
|
|
9326
9369
|
}
|
|
9327
9370
|
function setupLogLevel() {
|
|
9328
9371
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9343,7 +9386,7 @@ try {
|
|
|
9343
9386
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
9344
9387
|
}
|
|
9345
9388
|
}
|
|
9346
|
-
let src_version = "1.6.
|
|
9389
|
+
let src_version = "1.6.13";
|
|
9347
9390
|
})(), 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 === [
|
|
9348
9391
|
"PLUGIN_CSS_NAME",
|
|
9349
9392
|
"PLUGIN_SWC_NAME",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { NormalizedClientConfig } from '../types';
|
|
1
|
+
import type { LogLevel, NormalizedClientConfig } from '../types';
|
|
2
2
|
export declare const registerOverlay: (createFn: (html: string) => void, clearFn: () => void) => void;
|
|
3
|
-
export declare function init({ token, config, serverHost, serverPort, liveReload, browserLogs, }: {
|
|
3
|
+
export declare function init({ token, config, serverHost, serverPort, liveReload, browserLogs, logLevel, }: {
|
|
4
4
|
token: string;
|
|
5
5
|
config: NormalizedClientConfig;
|
|
6
6
|
serverHost: string;
|
|
7
7
|
serverPort: number;
|
|
8
8
|
liveReload: boolean;
|
|
9
9
|
browserLogs: boolean;
|
|
10
|
+
logLevel: LogLevel;
|
|
10
11
|
}): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogLevel } from '../types';
|
|
2
|
+
export declare const LOG_LEVEL: {
|
|
3
|
+
readonly silent: -1;
|
|
4
|
+
readonly error: 0;
|
|
5
|
+
readonly warn: 1;
|
|
6
|
+
readonly info: 2;
|
|
7
|
+
};
|
|
8
|
+
export declare const logger: {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
info(...messages: unknown[]): void;
|
|
11
|
+
warn(...messages: unknown[]): void;
|
|
12
|
+
error(...messages: unknown[]): void;
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types';
|
|
2
|
-
/** Normalize
|
|
3
|
-
export declare function
|
|
2
|
+
/** Normalize filename by removing hash for comparison across builds */
|
|
3
|
+
export declare function normalizeFilename(fileName: string): string;
|
|
4
4
|
/** Exclude source map and license files by default */
|
|
5
5
|
export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
|
|
6
6
|
export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
|
|
@@ -1537,6 +1537,11 @@ export type ClientConfig = {
|
|
|
1537
1537
|
* @default true
|
|
1538
1538
|
*/
|
|
1539
1539
|
overlay?: boolean;
|
|
1540
|
+
/**
|
|
1541
|
+
* Controls the log level for client-side logging in the browser console.
|
|
1542
|
+
* @default 'info'
|
|
1543
|
+
*/
|
|
1544
|
+
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
1540
1545
|
};
|
|
1541
1546
|
export type NormalizedClientConfig = Optional<Required<ClientConfig>, 'protocol'>;
|
|
1542
1547
|
export type { ChokidarOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "
|
|
49
|
+
"@rspack/core": "1.6.6",
|
|
50
50
|
"@rspack/lite-tapable": "~1.1.0",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.47.0",
|