@rsbuild/core 1.4.0-beta.5 → 1.4.0
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/rsbuild-dev-middleware/index.js +55 -47
- package/compiled/rsbuild-dev-middleware/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +88 -65
- package/dist/index.js +85 -64
- package/dist-types/index.d.ts +2 -2
- package/dist-types/server/compilationManager.d.ts +4 -0
- package/dist-types/server/compilationMiddleware.d.ts +1 -0
- package/dist-types/types/config.d.ts +4 -4
- package/dist-types/types/hooks.d.ts +31 -0
- package/dist-types/types/plugin.d.ts +7 -0
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
2562: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(7856);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(5241).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
7856: (__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__(9409));
|
|
15
|
-
var _plugins = __nccwpck_require__(
|
|
16
|
-
var _utils = __nccwpck_require__(
|
|
15
|
+
var _plugins = __nccwpck_require__(4655);
|
|
16
|
+
var _utils = __nccwpck_require__(5241);
|
|
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
|
+
4655: (__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__(3612),
|
|
262
262
|
);
|
|
263
263
|
var _postcssIcssParser = _interopRequireDefault(
|
|
264
|
-
__nccwpck_require__(
|
|
264
|
+
__nccwpck_require__(3321),
|
|
265
265
|
);
|
|
266
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
266
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9008));
|
|
267
267
|
function _interopRequireDefault(obj) {
|
|
268
268
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
|
|
271
|
+
3321: (__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__(9028);
|
|
276
|
-
var _utils = __nccwpck_require__(
|
|
276
|
+
var _utils = __nccwpck_require__(5241);
|
|
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
|
+
3612: (__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__(2948),
|
|
381
381
|
);
|
|
382
|
-
var _utils = __nccwpck_require__(
|
|
382
|
+
var _utils = __nccwpck_require__(5241);
|
|
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
|
+
9008: (__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__(2948),
|
|
693
693
|
);
|
|
694
|
-
var _utils = __nccwpck_require__(
|
|
694
|
+
var _utils = __nccwpck_require__(5241);
|
|
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
|
+
5241: (__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__(2562);
|
|
8102
8102
|
module.exports = __webpack_exports__;
|
|
8103
8103
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
528: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(773);
|
|
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
|
+
773: (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
|
+
979: (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
|
+
406: (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
|
+
613: (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
|
+
476: (module) => {
|
|
550
550
|
const voidTags = [
|
|
551
551
|
"area",
|
|
552
552
|
"base",
|
|
@@ -614,19 +614,19 @@
|
|
|
614
614
|
htmlTagObjectToString,
|
|
615
615
|
};
|
|
616
616
|
},
|
|
617
|
-
|
|
617
|
+
177: (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__(528);
|
|
624
624
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
625
|
-
__nccwpck_require__(
|
|
626
|
-
const prettyError = __nccwpck_require__(
|
|
627
|
-
const chunkSorter = __nccwpck_require__(
|
|
625
|
+
__nccwpck_require__(476);
|
|
626
|
+
const prettyError = __nccwpck_require__(406);
|
|
627
|
+
const chunkSorter = __nccwpck_require__(979);
|
|
628
628
|
const getHtmlRspackPluginHooks =
|
|
629
|
-
__nccwpck_require__(
|
|
629
|
+
__nccwpck_require__(613).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__(177);
|
|
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
|
+
414: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(148)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
148: (__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 _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(237);
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
237: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(414);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
|
@@ -4439,15 +4439,15 @@
|
|
|
4439
4439
|
return a.start - b.start;
|
|
4440
4440
|
}
|
|
4441
4441
|
},
|
|
4442
|
-
|
|
4442
|
+
4194: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4443
4443
|
"use strict";
|
|
4444
4444
|
const { logger } = __nccwpck_require__(8679);
|
|
4445
|
-
const middleware = __nccwpck_require__(
|
|
4446
|
-
const getFilenameFromUrl = __nccwpck_require__(
|
|
4447
|
-
const setupHooks = __nccwpck_require__(
|
|
4448
|
-
const setupWriteToDisk = __nccwpck_require__(
|
|
4449
|
-
const setupOutputFileSystem = __nccwpck_require__(
|
|
4450
|
-
const ready = __nccwpck_require__(
|
|
4445
|
+
const middleware = __nccwpck_require__(7808);
|
|
4446
|
+
const getFilenameFromUrl = __nccwpck_require__(7472);
|
|
4447
|
+
const setupHooks = __nccwpck_require__(7965);
|
|
4448
|
+
const setupWriteToDisk = __nccwpck_require__(7370);
|
|
4449
|
+
const setupOutputFileSystem = __nccwpck_require__(9403);
|
|
4450
|
+
const ready = __nccwpck_require__(4663);
|
|
4451
4451
|
const noop = () => {};
|
|
4452
4452
|
function wdm(compiler, options = {}) {
|
|
4453
4453
|
const context = {
|
|
@@ -4462,31 +4462,39 @@
|
|
|
4462
4462
|
setupWriteToDisk(context);
|
|
4463
4463
|
}
|
|
4464
4464
|
setupOutputFileSystem(context);
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4465
|
+
const filledContext = context;
|
|
4466
|
+
const instance = middleware(filledContext);
|
|
4467
|
+
instance.watch = () => {
|
|
4468
|
+
if (context.compiler.watching) {
|
|
4469
|
+
context.watching = context.compiler.watching;
|
|
4470
|
+
} else {
|
|
4471
|
+
const errorHandler = (error) => {
|
|
4472
|
+
if (error) {
|
|
4473
|
+
if (error.message && error.message.includes("× Error:")) {
|
|
4474
|
+
error.message = error.message.replace("× Error:", "").trim();
|
|
4475
|
+
}
|
|
4476
|
+
logger.error(error);
|
|
4472
4477
|
}
|
|
4473
|
-
|
|
4478
|
+
};
|
|
4479
|
+
if (Array.isArray(context.compiler.compilers)) {
|
|
4480
|
+
const multiCompiler = context.compiler;
|
|
4481
|
+
const watchOptions = multiCompiler.compilers.map(
|
|
4482
|
+
(childCompiler) => childCompiler.options.watchOptions || {},
|
|
4483
|
+
);
|
|
4484
|
+
context.watching = multiCompiler.watch(
|
|
4485
|
+
watchOptions,
|
|
4486
|
+
errorHandler,
|
|
4487
|
+
);
|
|
4488
|
+
} else {
|
|
4489
|
+
const singleCompiler = context.compiler;
|
|
4490
|
+
const watchOptions = singleCompiler.options.watchOptions || {};
|
|
4491
|
+
context.watching = singleCompiler.watch(
|
|
4492
|
+
watchOptions,
|
|
4493
|
+
errorHandler,
|
|
4494
|
+
);
|
|
4474
4495
|
}
|
|
4475
|
-
};
|
|
4476
|
-
if (Array.isArray(context.compiler.compilers)) {
|
|
4477
|
-
const multiCompiler = context.compiler;
|
|
4478
|
-
const watchOptions = multiCompiler.compilers.map(
|
|
4479
|
-
(childCompiler) => childCompiler.options.watchOptions || {},
|
|
4480
|
-
);
|
|
4481
|
-
context.watching = multiCompiler.watch(watchOptions, errorHandler);
|
|
4482
|
-
} else {
|
|
4483
|
-
const singleCompiler = context.compiler;
|
|
4484
|
-
const watchOptions = singleCompiler.options.watchOptions || {};
|
|
4485
|
-
context.watching = singleCompiler.watch(watchOptions, errorHandler);
|
|
4486
4496
|
}
|
|
4487
|
-
}
|
|
4488
|
-
const filledContext = context;
|
|
4489
|
-
const instance = middleware(filledContext);
|
|
4497
|
+
};
|
|
4490
4498
|
instance.getFilenameFromUrl = (url, extra) =>
|
|
4491
4499
|
getFilenameFromUrl(filledContext, url, extra);
|
|
4492
4500
|
instance.waitUntilValid = (callback = noop) => {
|
|
@@ -4504,15 +4512,15 @@
|
|
|
4504
4512
|
}
|
|
4505
4513
|
module.exports = wdm;
|
|
4506
4514
|
},
|
|
4507
|
-
|
|
4515
|
+
7808: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4508
4516
|
"use strict";
|
|
4509
4517
|
const mrmime = __nccwpck_require__(8311);
|
|
4510
4518
|
const { logger } = __nccwpck_require__(8679);
|
|
4511
4519
|
const onFinishedStream = __nccwpck_require__(21);
|
|
4512
|
-
const getFilenameFromUrl = __nccwpck_require__(
|
|
4513
|
-
const ready = __nccwpck_require__(
|
|
4514
|
-
const parseTokenList = __nccwpck_require__(
|
|
4515
|
-
const memorize = __nccwpck_require__(
|
|
4520
|
+
const getFilenameFromUrl = __nccwpck_require__(7472);
|
|
4521
|
+
const ready = __nccwpck_require__(4663);
|
|
4522
|
+
const parseTokenList = __nccwpck_require__(6018);
|
|
4523
|
+
const memorize = __nccwpck_require__(7436);
|
|
4516
4524
|
async function getEtag(stat) {
|
|
4517
4525
|
const mtime = stat.mtime.getTime().toString(16);
|
|
4518
4526
|
const size = stat.size.toString(16);
|
|
@@ -4604,7 +4612,7 @@
|
|
|
4604
4612
|
return;
|
|
4605
4613
|
}
|
|
4606
4614
|
function sendError(status, options) {
|
|
4607
|
-
const escapeHtml = __nccwpck_require__(
|
|
4615
|
+
const escapeHtml = __nccwpck_require__(3724);
|
|
4608
4616
|
const content = statuses[status] || String(status);
|
|
4609
4617
|
const document = Buffer.from(
|
|
4610
4618
|
`<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>${escapeHtml(content)}</pre>\n</body>\n</html>`,
|
|
@@ -4913,7 +4921,7 @@
|
|
|
4913
4921
|
}
|
|
4914
4922
|
module.exports = wrapper;
|
|
4915
4923
|
},
|
|
4916
|
-
|
|
4924
|
+
3724: (module) => {
|
|
4917
4925
|
"use strict";
|
|
4918
4926
|
const matchHtmlRegExp = /["'&<>]/;
|
|
4919
4927
|
function escapeHtml(string) {
|
|
@@ -4958,13 +4966,13 @@
|
|
|
4958
4966
|
}
|
|
4959
4967
|
module.exports = escapeHtml;
|
|
4960
4968
|
},
|
|
4961
|
-
|
|
4969
|
+
7472: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4962
4970
|
"use strict";
|
|
4963
4971
|
const path = __nccwpck_require__(6928);
|
|
4964
4972
|
const { parse } = __nccwpck_require__(7016);
|
|
4965
4973
|
const querystring = __nccwpck_require__(3480);
|
|
4966
|
-
const getPaths = __nccwpck_require__(
|
|
4967
|
-
const memorize = __nccwpck_require__(
|
|
4974
|
+
const getPaths = __nccwpck_require__(6686);
|
|
4975
|
+
const memorize = __nccwpck_require__(7436);
|
|
4968
4976
|
const memoizedParse = memorize(parse, undefined, (value) => {
|
|
4969
4977
|
if (value.pathname) {
|
|
4970
4978
|
value.pathname = decode(value.pathname);
|
|
@@ -5047,7 +5055,7 @@
|
|
|
5047
5055
|
}
|
|
5048
5056
|
module.exports = getFilenameFromUrl;
|
|
5049
5057
|
},
|
|
5050
|
-
|
|
5058
|
+
6686: (module) => {
|
|
5051
5059
|
"use strict";
|
|
5052
5060
|
function getPaths(context) {
|
|
5053
5061
|
const { stats, options } = context;
|
|
@@ -5068,7 +5076,7 @@
|
|
|
5068
5076
|
}
|
|
5069
5077
|
module.exports = getPaths;
|
|
5070
5078
|
},
|
|
5071
|
-
|
|
5079
|
+
7436: (module) => {
|
|
5072
5080
|
"use strict";
|
|
5073
5081
|
const cacheStore = new WeakMap();
|
|
5074
5082
|
function memorize(fn, { cache = new Map() } = {}, callback) {
|
|
@@ -5090,7 +5098,7 @@
|
|
|
5090
5098
|
}
|
|
5091
5099
|
module.exports = memorize;
|
|
5092
5100
|
},
|
|
5093
|
-
|
|
5101
|
+
6018: (module) => {
|
|
5094
5102
|
"use strict";
|
|
5095
5103
|
function parseTokenList(str) {
|
|
5096
5104
|
let end = 0;
|
|
@@ -5123,7 +5131,7 @@
|
|
|
5123
5131
|
}
|
|
5124
5132
|
module.exports = parseTokenList;
|
|
5125
5133
|
},
|
|
5126
|
-
|
|
5134
|
+
4663: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5127
5135
|
"use strict";
|
|
5128
5136
|
const { logger } = __nccwpck_require__(8679);
|
|
5129
5137
|
function ready(context, callback, req) {
|
|
@@ -5139,7 +5147,7 @@
|
|
|
5139
5147
|
}
|
|
5140
5148
|
module.exports = ready;
|
|
5141
5149
|
},
|
|
5142
|
-
|
|
5150
|
+
7965: (module) => {
|
|
5143
5151
|
"use strict";
|
|
5144
5152
|
function setupHooks(context) {
|
|
5145
5153
|
function invalid() {
|
|
@@ -5167,7 +5175,7 @@
|
|
|
5167
5175
|
}
|
|
5168
5176
|
module.exports = setupHooks;
|
|
5169
5177
|
},
|
|
5170
|
-
|
|
5178
|
+
9403: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5171
5179
|
"use strict";
|
|
5172
5180
|
const memfs = __nccwpck_require__(8672);
|
|
5173
5181
|
function setupOutputFileSystem(context) {
|
|
@@ -5194,7 +5202,7 @@
|
|
|
5194
5202
|
}
|
|
5195
5203
|
module.exports = setupOutputFileSystem;
|
|
5196
5204
|
},
|
|
5197
|
-
|
|
5205
|
+
7370: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5198
5206
|
"use strict";
|
|
5199
5207
|
const fs = __nccwpck_require__(9896);
|
|
5200
5208
|
const path = __nccwpck_require__(6928);
|
|
@@ -6185,6 +6193,6 @@
|
|
|
6185
6193
|
}
|
|
6186
6194
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
6187
6195
|
__nccwpck_require__.ab = __dirname + "/";
|
|
6188
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
6196
|
+
var __webpack_exports__ = __nccwpck_require__(4194);
|
|
6189
6197
|
module.exports = __webpack_exports__;
|
|
6190
6198
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.
|
|
1
|
+
{"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.3.0","funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
776: (__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
|
+
121: (__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 fs_1 = __nccwpck_require__(896);
|
|
131
131
|
const path_1 = __nccwpck_require__(928);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(776);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
exports.getCompilerHooks =
|
|
313
313
|
void 0;
|
|
314
314
|
const path_1 = __nccwpck_require__(928);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(121);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
package/dist/index.cjs
CHANGED
|
@@ -2247,7 +2247,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2247
2247
|
async function createContext(options, userConfig) {
|
|
2248
2248
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2249
2249
|
return {
|
|
2250
|
-
version: "1.4.0
|
|
2250
|
+
version: "1.4.0",
|
|
2251
2251
|
rootPath,
|
|
2252
2252
|
distPath: '',
|
|
2253
2253
|
cachePath,
|
|
@@ -3416,58 +3416,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3416
3416
|
scriptTests,
|
|
3417
3417
|
styleTests
|
|
3418
3418
|
};
|
|
3419
|
-
}
|
|
3420
|
-
function recursiveChunkEntryNames(chunk) {
|
|
3421
|
-
let [...chunkGroups] = chunk.groupsIterable;
|
|
3422
|
-
return [
|
|
3423
|
-
...new Set(chunkGroups.flatMap((chunkGroup)=>(function recursiveChunkGroup(chunkGroup, visited = new Set()) {
|
|
3424
|
-
if (visited.has(chunkGroup)) return [];
|
|
3425
|
-
visited.add(chunkGroup);
|
|
3426
|
-
let parents = chunkGroup.getParents();
|
|
3427
|
-
return parents.length ? parents.flatMap((chunkParent)=>recursiveChunkGroup(chunkParent, visited)) : [
|
|
3428
|
-
chunkGroup.name
|
|
3429
|
-
];
|
|
3430
|
-
})(chunkGroup)).filter((name)=>!!name))
|
|
3431
|
-
];
|
|
3432
|
-
}
|
|
3433
|
-
class PatchSplitChunksPlugin {
|
|
3434
|
-
apply(compiler) {
|
|
3435
|
-
let { splitChunks } = compiler.options.optimization;
|
|
3436
|
-
if (!splitChunks) return;
|
|
3437
|
-
let applyPatch = (config)=>{
|
|
3438
|
-
if ('object' != typeof config || (0, types_namespaceObject.isRegExp)(config)) return;
|
|
3439
|
-
let { chunks } = config;
|
|
3440
|
-
if (chunks && 'async' !== chunks) {
|
|
3441
|
-
if ('function' == typeof chunks) {
|
|
3442
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
3443
|
-
return;
|
|
3444
|
-
}
|
|
3445
|
-
if ('all' === chunks) {
|
|
3446
|
-
config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
3447
|
-
return;
|
|
3448
|
-
}
|
|
3449
|
-
if ('initial' === chunks) {
|
|
3450
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
|
|
3451
|
-
return;
|
|
3452
|
-
}
|
|
3453
|
-
}
|
|
3454
|
-
};
|
|
3455
|
-
applyPatch(splitChunks);
|
|
3456
|
-
let { cacheGroups } = splitChunks;
|
|
3457
|
-
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
|
|
3458
|
-
}
|
|
3459
|
-
constructor(name){
|
|
3460
|
-
!function(obj, key, value) {
|
|
3461
|
-
key in obj ? Object.defineProperty(obj, key, {
|
|
3462
|
-
value: value,
|
|
3463
|
-
enumerable: !0,
|
|
3464
|
-
configurable: !0,
|
|
3465
|
-
writable: !0
|
|
3466
|
-
}) : obj[key] = value;
|
|
3467
|
-
}(this, "name", void 0), this.name = name;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
|
|
3419
|
+
}, normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
|
|
3471
3420
|
if (path === base) return '/';
|
|
3472
3421
|
let trailingSlashBase = addTrailingSlash(base);
|
|
3473
3422
|
return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
|
|
@@ -3693,6 +3642,56 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3693
3642
|
}
|
|
3694
3643
|
})(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
|
|
3695
3644
|
}
|
|
3645
|
+
function recursiveChunkEntryNames(chunk) {
|
|
3646
|
+
let [...chunkGroups] = chunk.groupsIterable;
|
|
3647
|
+
return [
|
|
3648
|
+
...new Set(chunkGroups.flatMap((chunkGroup)=>(function recursiveChunkGroup(chunkGroup, visited = new Set()) {
|
|
3649
|
+
if (visited.has(chunkGroup)) return [];
|
|
3650
|
+
visited.add(chunkGroup);
|
|
3651
|
+
let parents = chunkGroup.getParents();
|
|
3652
|
+
return parents.length ? parents.flatMap((chunkParent)=>recursiveChunkGroup(chunkParent, visited)) : [
|
|
3653
|
+
chunkGroup.name
|
|
3654
|
+
];
|
|
3655
|
+
})(chunkGroup)).filter((name)=>!!name))
|
|
3656
|
+
];
|
|
3657
|
+
}
|
|
3658
|
+
class PatchSplitChunksPlugin {
|
|
3659
|
+
apply(compiler) {
|
|
3660
|
+
let { splitChunks } = compiler.options.optimization;
|
|
3661
|
+
if (!splitChunks) return;
|
|
3662
|
+
let applyPatch = (config)=>{
|
|
3663
|
+
if ('object' != typeof config || (0, types_namespaceObject.isRegExp)(config)) return;
|
|
3664
|
+
let { chunks } = config;
|
|
3665
|
+
if (chunks && 'async' !== chunks) {
|
|
3666
|
+
if ('function' == typeof chunks) {
|
|
3667
|
+
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
3668
|
+
return;
|
|
3669
|
+
}
|
|
3670
|
+
if ('all' === chunks) {
|
|
3671
|
+
config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
3672
|
+
return;
|
|
3673
|
+
}
|
|
3674
|
+
if ('initial' === chunks) {
|
|
3675
|
+
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
};
|
|
3680
|
+
applyPatch(splitChunks);
|
|
3681
|
+
let { cacheGroups } = splitChunks;
|
|
3682
|
+
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
|
|
3683
|
+
}
|
|
3684
|
+
constructor(name){
|
|
3685
|
+
!function(obj, key, value) {
|
|
3686
|
+
key in obj ? Object.defineProperty(obj, key, {
|
|
3687
|
+
value: value,
|
|
3688
|
+
enumerable: !0,
|
|
3689
|
+
configurable: !0,
|
|
3690
|
+
writable: !0
|
|
3691
|
+
}) : obj[key] = value;
|
|
3692
|
+
}(this, "name", void 0), this.name = name;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3696
3695
|
let resolve_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
3697
3696
|
function isAsyncChunk(chunk) {
|
|
3698
3697
|
return 'canBeInitial' in chunk ? !chunk.canBeInitial() : 'isInitial' in chunk && !chunk.isInitial();
|
|
@@ -4101,7 +4100,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4101
4100
|
}
|
|
4102
4101
|
class SocketServer {
|
|
4103
4102
|
clearHeartbeatTimer() {
|
|
4104
|
-
this.heartbeatTimer && (
|
|
4103
|
+
this.heartbeatTimer && (clearTimeout(this.heartbeatTimer), this.heartbeatTimer = null);
|
|
4105
4104
|
}
|
|
4106
4105
|
async prepare() {
|
|
4107
4106
|
var _this_options_client;
|
|
@@ -4420,6 +4419,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4420
4419
|
let { compiler } = this;
|
|
4421
4420
|
this.outputFileSystem = (helpers_isMultiCompiler(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem) || external_node_fs_default();
|
|
4422
4421
|
}
|
|
4422
|
+
watch() {
|
|
4423
|
+
this.middleware.watch();
|
|
4424
|
+
}
|
|
4423
4425
|
async close() {
|
|
4424
4426
|
await this.socketServer.close(), this.middleware && await new Promise((resolve)=>{
|
|
4425
4427
|
this.middleware.close(()=>{
|
|
@@ -4461,7 +4463,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4461
4463
|
req.url = url, next(...args);
|
|
4462
4464
|
})) : middleware(req, res, next);
|
|
4463
4465
|
};
|
|
4464
|
-
wrapper.close = middleware.close, this.middleware = wrapper;
|
|
4466
|
+
wrapper.close = middleware.close, wrapper.watch = middleware.watch, this.middleware = wrapper;
|
|
4465
4467
|
}
|
|
4466
4468
|
constructor({ dev, server, compiler, publicPaths, environments }){
|
|
4467
4469
|
compilationManager_define_property(this, "middleware", void 0), compilationManager_define_property(this, "outputFileSystem", void 0), compilationManager_define_property(this, "devConfig", void 0), compilationManager_define_property(this, "serverConfig", void 0), compilationManager_define_property(this, "compiler", void 0), compilationManager_define_property(this, "publicPaths", void 0), compilationManager_define_property(this, "socketServer", void 0), compilationManager_define_property(this, "readFileSync", (fileName)=>'readFileSync' in this.outputFileSystem ? this.outputFileSystem.readFileSync(fileName, 'utf-8') : external_node_fs_default().readFileSync(fileName, 'utf-8')), this.devConfig = ((config, environments)=>{
|
|
@@ -4590,7 +4592,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4590
4592
|
for (let middleware of proxyMiddlewares)'function' == typeof middleware.upgrade && middleware.upgrade(req, socket, head);
|
|
4591
4593
|
}
|
|
4592
4594
|
};
|
|
4593
|
-
}, applyDefaultMiddlewares = async ({
|
|
4595
|
+
}, applyDefaultMiddlewares = async ({ devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
|
|
4594
4596
|
let upgradeEvents = [];
|
|
4595
4597
|
if (server.cors) {
|
|
4596
4598
|
let { default: corsMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/cors/index.js"));
|
|
@@ -4604,9 +4606,15 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4604
4606
|
let { middlewares: proxyMiddlewares, upgrade } = await createProxyMiddleware(server.proxy);
|
|
4605
4607
|
for (let middleware of (upgradeEvents.push(upgrade), proxyMiddlewares))middlewares.push(middleware);
|
|
4606
4608
|
}
|
|
4607
|
-
if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType &&
|
|
4609
|
+
if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && compilationManager) {
|
|
4608
4610
|
let { compiler } = compilationManager;
|
|
4609
|
-
|
|
4611
|
+
(()=>{
|
|
4612
|
+
var _compiler_options_experiments;
|
|
4613
|
+
return helpers_isMultiCompiler(compiler) ? compiler.compilers.some((childCompiler)=>{
|
|
4614
|
+
var _childCompiler_options_experiments;
|
|
4615
|
+
return null == (_childCompiler_options_experiments = childCompiler.options.experiments) ? void 0 : _childCompiler_options_experiments.lazyCompilation;
|
|
4616
|
+
}) : null == (_compiler_options_experiments = compiler.options.experiments) ? void 0 : _compiler_options_experiments.lazyCompilation;
|
|
4617
|
+
})() && middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(compiler));
|
|
4610
4618
|
}
|
|
4611
4619
|
server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
|
|
4612
4620
|
base: server.base
|
|
@@ -4733,7 +4741,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4733
4741
|
'sockWrite',
|
|
4734
4742
|
'environments'
|
|
4735
4743
|
]), before = [], after = [];
|
|
4736
|
-
for (let handler of setupMiddlewares)handler({
|
|
4744
|
+
for (let handler of castArray(setupMiddlewares))handler({
|
|
4737
4745
|
unshift: (...handlers)=>before.unshift(...handlers),
|
|
4738
4746
|
push: (...handlers)=>after.push(...handlers)
|
|
4739
4747
|
}, serverOptions);
|
|
@@ -5270,7 +5278,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5270
5278
|
server: config.server,
|
|
5271
5279
|
postCallbacks
|
|
5272
5280
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5273
|
-
return index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
5281
|
+
return null == compilationManager || compilationManager.watch(), index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
5274
5282
|
}
|
|
5275
5283
|
let rspackProvider = async ({ context, pluginManager, rsbuildOptions })=>{
|
|
5276
5284
|
let createCompiler = async ()=>(await createCompiler_createCompiler({
|
|
@@ -5467,7 +5475,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5467
5475
|
{
|
|
5468
5476
|
name: 'rsbuild:basic',
|
|
5469
5477
|
setup (api) {
|
|
5470
|
-
api.modifyBundlerChain((chain, {
|
|
5478
|
+
api.modifyBundlerChain((chain, { isDev, target, bundler, environment, CHAIN_ID })=>{
|
|
5471
5479
|
let { config } = environment;
|
|
5472
5480
|
chain.name(environment.name);
|
|
5473
5481
|
let devtool = ((config)=>{
|
|
@@ -5489,7 +5497,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5489
5497
|
javascript: {
|
|
5490
5498
|
exportsPresence: 'error'
|
|
5491
5499
|
}
|
|
5492
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin),
|
|
5500
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), isDev && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), 'rspack' === api.context.bundlerType && chain.experiments({
|
|
5501
|
+
...chain.get('experiments'),
|
|
5502
|
+
rspackFuture: {
|
|
5503
|
+
bundlerInfo: {
|
|
5504
|
+
force: !!config.security.sri.enable
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
}), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
|
|
5493
5508
|
});
|
|
5494
5509
|
}
|
|
5495
5510
|
},
|
|
@@ -6867,6 +6882,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6867
6882
|
imports: !0
|
|
6868
6883
|
}
|
|
6869
6884
|
});
|
|
6885
|
+
if ('object' == typeof options && 'string' == typeof options.serverUrl && api.context.devServer) return void chain.experiments({
|
|
6886
|
+
...chain.get('experiments'),
|
|
6887
|
+
lazyCompilation: {
|
|
6888
|
+
...options,
|
|
6889
|
+
serverUrl: replacePortPlaceholder(options.serverUrl, api.context.devServer.port)
|
|
6890
|
+
}
|
|
6891
|
+
});
|
|
6870
6892
|
chain.experiments({
|
|
6871
6893
|
...chain.get('experiments'),
|
|
6872
6894
|
lazyCompilation: options
|
|
@@ -7128,6 +7150,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7128
7150
|
return {
|
|
7129
7151
|
context: publicContext,
|
|
7130
7152
|
expose,
|
|
7153
|
+
logger: index_js_namespaceObject.logger,
|
|
7131
7154
|
transform: (environment1 = environment, (descriptor, handler)=>{
|
|
7132
7155
|
let id = `rsbuild-transform-${transformId++}`;
|
|
7133
7156
|
transformer[id] = handler, hooks.modifyBundlerChain.tapEnvironment({
|
|
@@ -7496,11 +7519,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7496
7519
|
].includes(level) && (index_js_namespaceObject.logger.level = level);
|
|
7497
7520
|
}
|
|
7498
7521
|
let { npm_execpath } = process.env;
|
|
7499
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0
|
|
7522
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0\n`);
|
|
7500
7523
|
try {
|
|
7501
7524
|
!function() {
|
|
7502
7525
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7503
|
-
cli.help(), cli.version("1.4.0
|
|
7526
|
+
cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
7504
7527
|
default: 'jiti'
|
|
7505
7528
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
7506
7529
|
type: [
|
|
@@ -7558,7 +7581,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7558
7581
|
index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
|
|
7559
7582
|
}
|
|
7560
7583
|
}
|
|
7561
|
-
let src_version = "1.4.0
|
|
7584
|
+
let src_version = "1.4.0";
|
|
7562
7585
|
})(), 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 === [
|
|
7563
7586
|
"PLUGIN_CSS_NAME",
|
|
7564
7587
|
"PLUGIN_SWC_NAME",
|
package/dist/index.js
CHANGED
|
@@ -2059,7 +2059,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2059
2059
|
async function createContext(options, userConfig) {
|
|
2060
2060
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2061
2061
|
return {
|
|
2062
|
-
version: "1.4.0
|
|
2062
|
+
version: "1.4.0",
|
|
2063
2063
|
rootPath,
|
|
2064
2064
|
distPath: '',
|
|
2065
2065
|
cachePath,
|
|
@@ -3218,57 +3218,7 @@ let getInlineTests = (config)=>{
|
|
|
3218
3218
|
scriptTests,
|
|
3219
3219
|
styleTests
|
|
3220
3220
|
};
|
|
3221
|
-
}
|
|
3222
|
-
function recursiveChunkEntryNames(chunk) {
|
|
3223
|
-
let [...chunkGroups] = chunk.groupsIterable;
|
|
3224
|
-
return [
|
|
3225
|
-
...new Set(chunkGroups.flatMap((chunkGroup)=>(function recursiveChunkGroup(chunkGroup, visited = new Set()) {
|
|
3226
|
-
if (visited.has(chunkGroup)) return [];
|
|
3227
|
-
visited.add(chunkGroup);
|
|
3228
|
-
let parents = chunkGroup.getParents();
|
|
3229
|
-
return parents.length ? parents.flatMap((chunkParent)=>recursiveChunkGroup(chunkParent, visited)) : [
|
|
3230
|
-
chunkGroup.name
|
|
3231
|
-
];
|
|
3232
|
-
})(chunkGroup)).filter((name)=>!!name))
|
|
3233
|
-
];
|
|
3234
|
-
}
|
|
3235
|
-
class PatchSplitChunksPlugin {
|
|
3236
|
-
apply(compiler) {
|
|
3237
|
-
let { splitChunks } = compiler.options.optimization;
|
|
3238
|
-
if (!splitChunks) return;
|
|
3239
|
-
let applyPatch = (config)=>{
|
|
3240
|
-
if ('object' != typeof config || isRegExp(config)) return;
|
|
3241
|
-
let { chunks } = config;
|
|
3242
|
-
if (chunks && 'async' !== chunks) {
|
|
3243
|
-
if ('function' == typeof chunks) {
|
|
3244
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
3245
|
-
return;
|
|
3246
|
-
}
|
|
3247
|
-
if ('all' === chunks) {
|
|
3248
|
-
config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
3249
|
-
return;
|
|
3250
|
-
}
|
|
3251
|
-
if ('initial' === chunks) {
|
|
3252
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
|
|
3253
|
-
return;
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
};
|
|
3257
|
-
applyPatch(splitChunks);
|
|
3258
|
-
let { cacheGroups } = splitChunks;
|
|
3259
|
-
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
|
|
3260
|
-
}
|
|
3261
|
-
constructor(name){
|
|
3262
|
-
var key, value;
|
|
3263
|
-
value = void 0, (key = "name") in this ? Object.defineProperty(this, key, {
|
|
3264
|
-
value: value,
|
|
3265
|
-
enumerable: !0,
|
|
3266
|
-
configurable: !0,
|
|
3267
|
-
writable: !0
|
|
3268
|
-
}) : this[key] = value, this.name = name;
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
|
|
3221
|
+
}, normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
|
|
3272
3222
|
if (path === base) return '/';
|
|
3273
3223
|
let trailingSlashBase = addTrailingSlash(base);
|
|
3274
3224
|
return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
|
|
@@ -3493,6 +3443,55 @@ async function open_open({ https, port, routes, config, clearCache }) {
|
|
|
3493
3443
|
}
|
|
3494
3444
|
})(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
|
|
3495
3445
|
}
|
|
3446
|
+
function recursiveChunkEntryNames(chunk) {
|
|
3447
|
+
let [...chunkGroups] = chunk.groupsIterable;
|
|
3448
|
+
return [
|
|
3449
|
+
...new Set(chunkGroups.flatMap((chunkGroup)=>(function recursiveChunkGroup(chunkGroup, visited = new Set()) {
|
|
3450
|
+
if (visited.has(chunkGroup)) return [];
|
|
3451
|
+
visited.add(chunkGroup);
|
|
3452
|
+
let parents = chunkGroup.getParents();
|
|
3453
|
+
return parents.length ? parents.flatMap((chunkParent)=>recursiveChunkGroup(chunkParent, visited)) : [
|
|
3454
|
+
chunkGroup.name
|
|
3455
|
+
];
|
|
3456
|
+
})(chunkGroup)).filter((name)=>!!name))
|
|
3457
|
+
];
|
|
3458
|
+
}
|
|
3459
|
+
class PatchSplitChunksPlugin {
|
|
3460
|
+
apply(compiler) {
|
|
3461
|
+
let { splitChunks } = compiler.options.optimization;
|
|
3462
|
+
if (!splitChunks) return;
|
|
3463
|
+
let applyPatch = (config)=>{
|
|
3464
|
+
if ('object' != typeof config || isRegExp(config)) return;
|
|
3465
|
+
let { chunks } = config;
|
|
3466
|
+
if (chunks && 'async' !== chunks) {
|
|
3467
|
+
if ('function' == typeof chunks) {
|
|
3468
|
+
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
3469
|
+
return;
|
|
3470
|
+
}
|
|
3471
|
+
if ('all' === chunks) {
|
|
3472
|
+
config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
if ('initial' === chunks) {
|
|
3476
|
+
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3481
|
+
applyPatch(splitChunks);
|
|
3482
|
+
let { cacheGroups } = splitChunks;
|
|
3483
|
+
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
|
|
3484
|
+
}
|
|
3485
|
+
constructor(name){
|
|
3486
|
+
var key, value;
|
|
3487
|
+
value = void 0, (key = "name") in this ? Object.defineProperty(this, key, {
|
|
3488
|
+
value: value,
|
|
3489
|
+
enumerable: !0,
|
|
3490
|
+
configurable: !0,
|
|
3491
|
+
writable: !0
|
|
3492
|
+
}) : this[key] = value, this.name = name;
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3496
3495
|
let resolve_require = createRequire(import.meta.url);
|
|
3497
3496
|
function isAsyncChunk(chunk) {
|
|
3498
3497
|
return 'canBeInitial' in chunk ? !chunk.canBeInitial() : 'isInitial' in chunk && !chunk.isInitial();
|
|
@@ -3898,7 +3897,7 @@ function socketServer_define_property(obj, key, value) {
|
|
|
3898
3897
|
}
|
|
3899
3898
|
class SocketServer {
|
|
3900
3899
|
clearHeartbeatTimer() {
|
|
3901
|
-
this.heartbeatTimer && (
|
|
3900
|
+
this.heartbeatTimer && (clearTimeout(this.heartbeatTimer), this.heartbeatTimer = null);
|
|
3902
3901
|
}
|
|
3903
3902
|
async prepare() {
|
|
3904
3903
|
var _this_options_client;
|
|
@@ -4216,6 +4215,9 @@ class CompilationManager {
|
|
|
4216
4215
|
let { compiler } = this;
|
|
4217
4216
|
this.outputFileSystem = (helpers_isMultiCompiler(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem) || node_fs;
|
|
4218
4217
|
}
|
|
4218
|
+
watch() {
|
|
4219
|
+
this.middleware.watch();
|
|
4220
|
+
}
|
|
4219
4221
|
async close() {
|
|
4220
4222
|
await this.socketServer.close(), this.middleware && await new Promise((resolve)=>{
|
|
4221
4223
|
this.middleware.close(()=>{
|
|
@@ -4257,7 +4259,7 @@ class CompilationManager {
|
|
|
4257
4259
|
req.url = url, next(...args);
|
|
4258
4260
|
})) : middleware(req, res, next);
|
|
4259
4261
|
};
|
|
4260
|
-
wrapper.close = middleware.close, this.middleware = wrapper;
|
|
4262
|
+
wrapper.close = middleware.close, wrapper.watch = middleware.watch, this.middleware = wrapper;
|
|
4261
4263
|
}
|
|
4262
4264
|
constructor({ dev, server, compiler, publicPaths, environments }){
|
|
4263
4265
|
compilationManager_define_property(this, "middleware", void 0), compilationManager_define_property(this, "outputFileSystem", void 0), compilationManager_define_property(this, "devConfig", void 0), compilationManager_define_property(this, "serverConfig", void 0), compilationManager_define_property(this, "compiler", void 0), compilationManager_define_property(this, "publicPaths", void 0), compilationManager_define_property(this, "socketServer", void 0), compilationManager_define_property(this, "readFileSync", (fileName)=>'readFileSync' in this.outputFileSystem ? this.outputFileSystem.readFileSync(fileName, 'utf-8') : node_fs.readFileSync(fileName, 'utf-8')), this.devConfig = ((config, environments)=>{
|
|
@@ -4386,7 +4388,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
4386
4388
|
for (let middleware of proxyMiddlewares)'function' == typeof middleware.upgrade && middleware.upgrade(req, socket, head);
|
|
4387
4389
|
}
|
|
4388
4390
|
};
|
|
4389
|
-
}, applyDefaultMiddlewares = async ({
|
|
4391
|
+
}, applyDefaultMiddlewares = async ({ devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
|
|
4390
4392
|
let upgradeEvents = [];
|
|
4391
4393
|
if (server.cors) {
|
|
4392
4394
|
let { default: corsMiddleware } = await import("../compiled/cors/index.js");
|
|
@@ -4400,9 +4402,13 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
4400
4402
|
let { middlewares: proxyMiddlewares, upgrade } = await createProxyMiddleware(server.proxy);
|
|
4401
4403
|
for (let middleware of (upgradeEvents.push(upgrade), proxyMiddlewares))middlewares.push(middleware);
|
|
4402
4404
|
}
|
|
4403
|
-
if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType &&
|
|
4405
|
+
if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && compilationManager) {
|
|
4406
|
+
var _compiler_options_experiments;
|
|
4404
4407
|
let { compiler } = compilationManager;
|
|
4405
|
-
|
|
4408
|
+
(helpers_isMultiCompiler(compiler) ? compiler.compilers.some((childCompiler)=>{
|
|
4409
|
+
var _childCompiler_options_experiments;
|
|
4410
|
+
return null == (_childCompiler_options_experiments = childCompiler.options.experiments) ? void 0 : _childCompiler_options_experiments.lazyCompilation;
|
|
4411
|
+
}) : null == (_compiler_options_experiments = compiler.options.experiments) ? void 0 : _compiler_options_experiments.lazyCompilation) && middlewares.push(rspack.experiments.lazyCompilationMiddleware(compiler));
|
|
4406
4412
|
}
|
|
4407
4413
|
server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
|
|
4408
4414
|
base: server.base
|
|
@@ -4529,7 +4535,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
4529
4535
|
'sockWrite',
|
|
4530
4536
|
'environments'
|
|
4531
4537
|
]), before = [], after = [];
|
|
4532
|
-
for (let handler of setupMiddlewares)handler({
|
|
4538
|
+
for (let handler of castArray(setupMiddlewares))handler({
|
|
4533
4539
|
unshift: (...handlers)=>before.unshift(...handlers),
|
|
4534
4540
|
push: (...handlers)=>after.push(...handlers)
|
|
4535
4541
|
}, serverOptions);
|
|
@@ -5059,7 +5065,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5059
5065
|
server: config.server,
|
|
5060
5066
|
postCallbacks
|
|
5061
5067
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5062
|
-
return logger.debug('create dev server done'), devServerAPI;
|
|
5068
|
+
return null == compilationManager || compilationManager.watch(), logger.debug('create dev server done'), devServerAPI;
|
|
5063
5069
|
}
|
|
5064
5070
|
let rspackProvider = async ({ context, pluginManager, rsbuildOptions })=>{
|
|
5065
5071
|
let createCompiler = async ()=>(await createCompiler_createCompiler({
|
|
@@ -5255,7 +5261,7 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
5255
5261
|
{
|
|
5256
5262
|
name: 'rsbuild:basic',
|
|
5257
5263
|
setup (api) {
|
|
5258
|
-
api.modifyBundlerChain((chain, {
|
|
5264
|
+
api.modifyBundlerChain((chain, { isDev, target, bundler, environment, CHAIN_ID })=>{
|
|
5259
5265
|
let { config } = environment;
|
|
5260
5266
|
chain.name(environment.name);
|
|
5261
5267
|
let devtool = ((config)=>{
|
|
@@ -5277,7 +5283,14 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
5277
5283
|
javascript: {
|
|
5278
5284
|
exportsPresence: 'error'
|
|
5279
5285
|
}
|
|
5280
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin),
|
|
5286
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), isDev && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), 'rspack' === api.context.bundlerType && chain.experiments({
|
|
5287
|
+
...chain.get('experiments'),
|
|
5288
|
+
rspackFuture: {
|
|
5289
|
+
bundlerInfo: {
|
|
5290
|
+
force: !!config.security.sri.enable
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5293
|
+
}), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
|
|
5281
5294
|
});
|
|
5282
5295
|
}
|
|
5283
5296
|
},
|
|
@@ -6653,6 +6666,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6653
6666
|
imports: !0
|
|
6654
6667
|
}
|
|
6655
6668
|
});
|
|
6669
|
+
if ('object' == typeof options && 'string' == typeof options.serverUrl && api.context.devServer) return void chain.experiments({
|
|
6670
|
+
...chain.get('experiments'),
|
|
6671
|
+
lazyCompilation: {
|
|
6672
|
+
...options,
|
|
6673
|
+
serverUrl: replacePortPlaceholder(options.serverUrl, api.context.devServer.port)
|
|
6674
|
+
}
|
|
6675
|
+
});
|
|
6656
6676
|
chain.experiments({
|
|
6657
6677
|
...chain.get('experiments'),
|
|
6658
6678
|
lazyCompilation: options
|
|
@@ -6911,6 +6931,7 @@ async function createRsbuild(options = {}) {
|
|
|
6911
6931
|
return (environment)=>({
|
|
6912
6932
|
context: publicContext,
|
|
6913
6933
|
expose,
|
|
6934
|
+
logger: logger,
|
|
6914
6935
|
transform: (descriptor, handler)=>{
|
|
6915
6936
|
let id = `rsbuild-transform-${transformId++}`;
|
|
6916
6937
|
transformer[id] = handler, hooks.modifyBundlerChain.tapEnvironment({
|
|
@@ -7278,11 +7299,11 @@ async function runCLI() {
|
|
|
7278
7299
|
].includes(level) && (logger.level = level);
|
|
7279
7300
|
}
|
|
7280
7301
|
let { npm_execpath } = process.env;
|
|
7281
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0
|
|
7302
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0\n`);
|
|
7282
7303
|
try {
|
|
7283
7304
|
!function() {
|
|
7284
7305
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7285
|
-
cli.help(), cli.version("1.4.0
|
|
7306
|
+
cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
7286
7307
|
default: 'jiti'
|
|
7287
7308
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
7288
7309
|
type: [
|
|
@@ -7340,5 +7361,5 @@ async function runCLI() {
|
|
|
7340
7361
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
7341
7362
|
}
|
|
7342
7363
|
}
|
|
7343
|
-
let src_version = "1.4.0
|
|
7364
|
+
let src_version = "1.4.0";
|
|
7344
7365
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
|
package/dist-types/index.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type { ChainIdentifier } from './configChain';
|
|
|
15
15
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME } from './constants';
|
|
16
16
|
export { defaultAllowedOrigins } from './defaultConfig';
|
|
17
17
|
export { ensureAssetPrefix } from './helpers';
|
|
18
|
-
export { logger } from './logger';
|
|
18
|
+
export { type Logger, logger } from './logger';
|
|
19
19
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
|
21
21
|
export type { StartServerResult } from './server/helper';
|
|
22
|
-
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig,
|
|
22
|
+
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
@@ -23,6 +23,10 @@ export declare class CompilationManager {
|
|
|
23
23
|
socketServer: SocketServer;
|
|
24
24
|
constructor({ dev, server, compiler, publicPaths, environments }: Options);
|
|
25
25
|
init(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Call `compiler.watch()` to start compiling.
|
|
28
|
+
*/
|
|
29
|
+
watch(): void;
|
|
26
30
|
close(): Promise<void>;
|
|
27
31
|
readFileSync: (fileName: string) => string;
|
|
28
32
|
private setupCompilationMiddleware;
|
|
@@ -26,6 +26,7 @@ export type CompilationMiddlewareOptions = {
|
|
|
26
26
|
};
|
|
27
27
|
export type CompilationMiddleware = Middleware & {
|
|
28
28
|
close: (callback: (err: Error | null | undefined) => void) => any;
|
|
29
|
+
watch: () => void;
|
|
29
30
|
};
|
|
30
31
|
/**
|
|
31
32
|
* The CompilationMiddleware handles compiler setup for development:
|
|
@@ -1273,11 +1273,11 @@ export type EnvironmentAPI = {
|
|
|
1273
1273
|
context: EnvironmentContext;
|
|
1274
1274
|
};
|
|
1275
1275
|
};
|
|
1276
|
-
export type
|
|
1276
|
+
export type SetupMiddlewaresContext = Pick<RsbuildDevServer, 'sockWrite' | 'environments'>;
|
|
1277
1277
|
export type SetupMiddlewaresFn = (middlewares: {
|
|
1278
1278
|
unshift: (...handlers: RequestHandler[]) => void;
|
|
1279
1279
|
push: (...handlers: RequestHandler[]) => void;
|
|
1280
|
-
}, server:
|
|
1280
|
+
}, server: SetupMiddlewaresContext) => void;
|
|
1281
1281
|
export type ClientConfig = {
|
|
1282
1282
|
/**
|
|
1283
1283
|
* The path for the WebSocket request.
|
|
@@ -1375,9 +1375,9 @@ export interface DevConfig {
|
|
|
1375
1375
|
help?: boolean | string;
|
|
1376
1376
|
};
|
|
1377
1377
|
/**
|
|
1378
|
-
*
|
|
1378
|
+
* Used to add custom middleware to the dev server.
|
|
1379
1379
|
*/
|
|
1380
|
-
setupMiddlewares?: SetupMiddlewaresFn[];
|
|
1380
|
+
setupMiddlewares?: SetupMiddlewaresFn | SetupMiddlewaresFn[];
|
|
1381
1381
|
/**
|
|
1382
1382
|
* Controls whether the build output from development mode is written to disk.
|
|
1383
1383
|
* @default false
|
|
@@ -163,14 +163,45 @@ export type ModifyChainUtils = {
|
|
|
163
163
|
* The value of `process.env.NODE_ENV`
|
|
164
164
|
*/
|
|
165
165
|
env: string;
|
|
166
|
+
/**
|
|
167
|
+
* A boolean value indicating whether this is a development build.
|
|
168
|
+
* Set to `true` when the `mode` is `development`.
|
|
169
|
+
*/
|
|
166
170
|
isDev: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* A boolean value indicating whether this is a production build.
|
|
173
|
+
* Set to `true` when the `mode` is `production`.
|
|
174
|
+
*/
|
|
167
175
|
isProd: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* The current build target.
|
|
178
|
+
*/
|
|
168
179
|
target: RsbuildTarget;
|
|
180
|
+
/**
|
|
181
|
+
* A boolean value indicating whether the build target is `node`.
|
|
182
|
+
* Equivalent to `target === 'node'`.
|
|
183
|
+
*/
|
|
169
184
|
isServer: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* A boolean value indicating whether the build target is `web-worker`.
|
|
187
|
+
* Equivalent to `target === 'web-worker'`.
|
|
188
|
+
*/
|
|
170
189
|
isWebWorker: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Predefined chain IDs.
|
|
192
|
+
*/
|
|
171
193
|
CHAIN_ID: ChainIdentifier;
|
|
194
|
+
/**
|
|
195
|
+
* The environment context for current build.
|
|
196
|
+
*/
|
|
172
197
|
environment: EnvironmentContext;
|
|
198
|
+
/**
|
|
199
|
+
* The Rspack instance, same as `import { rspack } from '@rsbuild/core'`.
|
|
200
|
+
*/
|
|
173
201
|
rspack: typeof rspack;
|
|
202
|
+
/**
|
|
203
|
+
* The default export of `html-rspack-plugin`.
|
|
204
|
+
*/
|
|
174
205
|
HtmlPlugin: typeof HtmlRspackPlugin;
|
|
175
206
|
};
|
|
176
207
|
interface PluginInstance {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { RuleSetRule, Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack';
|
|
3
3
|
import type RspackChain from '../../compiled/rspack-chain';
|
|
4
4
|
import type { ChainIdentifier } from '../configChain';
|
|
5
|
+
import type { Logger } from '../logger';
|
|
5
6
|
import type { ModifyRspackConfigUtils, NarrowedRspackConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig, RspackMerge } from './config';
|
|
6
7
|
import type { RsbuildContext } from './context';
|
|
7
8
|
import type { EnvironmentContext, ModifyBundlerChainFn, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './hooks';
|
|
@@ -369,6 +370,12 @@ export type RsbuildPluginAPI = Readonly<{
|
|
|
369
370
|
* `modifyRsbuildConfig` hook is executed.
|
|
370
371
|
*/
|
|
371
372
|
getNormalizedConfig: typeof getNormalizedConfig;
|
|
373
|
+
/**
|
|
374
|
+
* A logger instance used to output log information in a unified format.
|
|
375
|
+
* Use this instead of `console.log` to maintain consistent logging with Rsbuild.
|
|
376
|
+
* Equivalent to `import { logger } from '@rsbuild/core'`.
|
|
377
|
+
*/
|
|
378
|
+
logger: Logger;
|
|
372
379
|
/**
|
|
373
380
|
* Determines if a plugin has been registered in the current Rsbuild instance.
|
|
374
381
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.4.0
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.4.0
|
|
49
|
+
"@rspack/core": "1.4.0",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.43.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.10.
|
|
56
|
+
"@rslib/core": "0.10.2",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
58
|
"@types/cors": "^2.8.19",
|
|
59
59
|
"@types/node": "^22.15.32",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"postcss-loader": "8.1.1",
|
|
82
82
|
"prebundle": "1.3.3",
|
|
83
83
|
"reduce-configs": "^1.1.0",
|
|
84
|
-
"rsbuild-dev-middleware": "0.
|
|
84
|
+
"rsbuild-dev-middleware": "0.3.0",
|
|
85
85
|
"rslog": "^1.2.7",
|
|
86
86
|
"rspack-chain": "^1.2.6",
|
|
87
87
|
"rspack-manifest-plugin": "5.0.3",
|