@rsbuild/core 0.7.0-beta.8 → 0.7.0-beta.9
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 +20 -20
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/client/hmr.js +17 -0
- package/dist/index.cjs +70 -27
- package/dist/index.js +70 -27
- package/dist-types/server/httpServer.d.ts +4 -3
- package/dist-types/server/prodServer.d.ts +3 -1
- package/package.json +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 7865:
|
|
5
5
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const loader = __nccwpck_require__(
|
|
10
|
+
const loader = __nccwpck_require__(3898);
|
|
11
11
|
module.exports = loader.default;
|
|
12
|
-
module.exports.defaultGetLocalIdent = __nccwpck_require__(
|
|
12
|
+
module.exports.defaultGetLocalIdent = __nccwpck_require__(6313).defaultGetLocalIdent;
|
|
13
13
|
|
|
14
14
|
/***/ }),
|
|
15
15
|
|
|
16
|
-
/***/
|
|
16
|
+
/***/ 3898:
|
|
17
17
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
18
18
|
|
|
19
19
|
"use strict";
|
|
@@ -26,9 +26,9 @@ exports["default"] = loader;
|
|
|
26
26
|
var _postcss = _interopRequireDefault(__nccwpck_require__(977));
|
|
27
27
|
var _package = _interopRequireDefault(__nccwpck_require__(5446));
|
|
28
28
|
var _semver = __nccwpck_require__(1280);
|
|
29
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
30
|
-
var _plugins = __nccwpck_require__(
|
|
31
|
-
var _utils = __nccwpck_require__(
|
|
29
|
+
var _options = _interopRequireDefault(__nccwpck_require__(7009));
|
|
30
|
+
var _plugins = __nccwpck_require__(4535);
|
|
31
|
+
var _utils = __nccwpck_require__(6313);
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
/*
|
|
34
34
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
@@ -211,7 +211,7 @@ async function loader(content, map, meta) {
|
|
|
211
211
|
|
|
212
212
|
/***/ }),
|
|
213
213
|
|
|
214
|
-
/***/
|
|
214
|
+
/***/ 4535:
|
|
215
215
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
216
216
|
|
|
217
217
|
"use strict";
|
|
@@ -238,14 +238,14 @@ Object.defineProperty(exports, "urlParser", ({
|
|
|
238
238
|
return _postcssUrlParser.default;
|
|
239
239
|
}
|
|
240
240
|
}));
|
|
241
|
-
var _postcssImportParser = _interopRequireDefault(__nccwpck_require__(
|
|
242
|
-
var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(
|
|
243
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
241
|
+
var _postcssImportParser = _interopRequireDefault(__nccwpck_require__(5485));
|
|
242
|
+
var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(6777));
|
|
243
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(1379));
|
|
244
244
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
245
245
|
|
|
246
246
|
/***/ }),
|
|
247
247
|
|
|
248
|
-
/***/
|
|
248
|
+
/***/ 6777:
|
|
249
249
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
250
250
|
|
|
251
251
|
"use strict";
|
|
@@ -256,7 +256,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
256
256
|
}));
|
|
257
257
|
exports["default"] = void 0;
|
|
258
258
|
var _icssUtils = __nccwpck_require__(3275);
|
|
259
|
-
var _utils = __nccwpck_require__(
|
|
259
|
+
var _utils = __nccwpck_require__(6313);
|
|
260
260
|
const plugin = (options = {}) => {
|
|
261
261
|
return {
|
|
262
262
|
postcssPlugin: "postcss-icss-parser",
|
|
@@ -365,7 +365,7 @@ var _default = exports["default"] = plugin;
|
|
|
365
365
|
|
|
366
366
|
/***/ }),
|
|
367
367
|
|
|
368
|
-
/***/
|
|
368
|
+
/***/ 5485:
|
|
369
369
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
370
370
|
|
|
371
371
|
"use strict";
|
|
@@ -376,7 +376,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
376
376
|
}));
|
|
377
377
|
exports["default"] = void 0;
|
|
378
378
|
var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1036));
|
|
379
|
-
var _utils = __nccwpck_require__(
|
|
379
|
+
var _utils = __nccwpck_require__(6313);
|
|
380
380
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
381
381
|
function parseNode(atRule, key, options) {
|
|
382
382
|
// Convert only top-level @import
|
|
@@ -654,7 +654,7 @@ var _default = exports["default"] = plugin;
|
|
|
654
654
|
|
|
655
655
|
/***/ }),
|
|
656
656
|
|
|
657
|
-
/***/
|
|
657
|
+
/***/ 1379:
|
|
658
658
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
659
659
|
|
|
660
660
|
"use strict";
|
|
@@ -665,7 +665,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
665
665
|
}));
|
|
666
666
|
exports["default"] = void 0;
|
|
667
667
|
var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1036));
|
|
668
|
-
var _utils = __nccwpck_require__(
|
|
668
|
+
var _utils = __nccwpck_require__(6313);
|
|
669
669
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
670
670
|
const isUrlFunc = /url/i;
|
|
671
671
|
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
|
|
@@ -1017,7 +1017,7 @@ var _default = exports["default"] = plugin;
|
|
|
1017
1017
|
|
|
1018
1018
|
/***/ }),
|
|
1019
1019
|
|
|
1020
|
-
/***/
|
|
1020
|
+
/***/ 6313:
|
|
1021
1021
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1022
1022
|
|
|
1023
1023
|
"use strict";
|
|
@@ -7298,7 +7298,7 @@ module.exports = require("util");
|
|
|
7298
7298
|
|
|
7299
7299
|
/***/ }),
|
|
7300
7300
|
|
|
7301
|
-
/***/
|
|
7301
|
+
/***/ 7009:
|
|
7302
7302
|
/***/ ((module) => {
|
|
7303
7303
|
|
|
7304
7304
|
"use strict";
|
|
@@ -7356,7 +7356,7 @@ module.exports = JSON.parse('{"name":"postcss","version":"8.4.38","description":
|
|
|
7356
7356
|
/******/ // startup
|
|
7357
7357
|
/******/ // Load entry module and return exports
|
|
7358
7358
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
7359
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
7359
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(7865);
|
|
7360
7360
|
/******/ module.exports = __webpack_exports__;
|
|
7361
7361
|
/******/
|
|
7362
7362
|
/******/ })()
|
|
@@ -7702,17 +7702,17 @@ module.exports.createColors = createColors
|
|
|
7702
7702
|
|
|
7703
7703
|
/***/ }),
|
|
7704
7704
|
|
|
7705
|
-
/***/
|
|
7705
|
+
/***/ 7753:
|
|
7706
7706
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
7707
7707
|
|
|
7708
7708
|
"use strict";
|
|
7709
7709
|
|
|
7710
7710
|
|
|
7711
|
-
module.exports = __nccwpck_require__(
|
|
7711
|
+
module.exports = __nccwpck_require__(9089)["default"];
|
|
7712
7712
|
|
|
7713
7713
|
/***/ }),
|
|
7714
7714
|
|
|
7715
|
-
/***/
|
|
7715
|
+
/***/ 9089:
|
|
7716
7716
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
7717
7717
|
|
|
7718
7718
|
"use strict";
|
|
@@ -7725,8 +7725,8 @@ __webpack_unused_export__ = ({
|
|
|
7725
7725
|
exports["default"] = loader;
|
|
7726
7726
|
var _path = _interopRequireDefault(__nccwpck_require__(1017));
|
|
7727
7727
|
var _package = _interopRequireDefault(__nccwpck_require__(5446));
|
|
7728
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
7729
|
-
var _utils = __nccwpck_require__(
|
|
7728
|
+
var _options = _interopRequireDefault(__nccwpck_require__(804));
|
|
7729
|
+
var _utils = __nccwpck_require__(7946);
|
|
7730
7730
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7731
7731
|
let hasExplicitDependencyOnPostCSS = false;
|
|
7732
7732
|
|
|
@@ -7892,7 +7892,7 @@ async function loader(content, sourceMap, meta) {
|
|
|
7892
7892
|
|
|
7893
7893
|
/***/ }),
|
|
7894
7894
|
|
|
7895
|
-
/***/
|
|
7895
|
+
/***/ 7946:
|
|
7896
7896
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|
7897
7897
|
|
|
7898
7898
|
"use strict";
|
|
@@ -9143,7 +9143,7 @@ function highlight(code, options = {}) {
|
|
|
9143
9143
|
|
|
9144
9144
|
/***/ }),
|
|
9145
9145
|
|
|
9146
|
-
/***/
|
|
9146
|
+
/***/ 804:
|
|
9147
9147
|
/***/ ((module) => {
|
|
9148
9148
|
|
|
9149
9149
|
"use strict";
|
|
@@ -9271,7 +9271,7 @@ module.exports = JSON.parse('{"name":"postcss","version":"8.4.38","description":
|
|
|
9271
9271
|
/******/ // startup
|
|
9272
9272
|
/******/ // Load entry module and return exports
|
|
9273
9273
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
9274
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
9274
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(7753);
|
|
9275
9275
|
/******/ module.exports = __webpack_exports__;
|
|
9276
9276
|
/******/
|
|
9277
9277
|
/******/ })()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 8176:
|
|
5
5
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
@@ -105,7 +105,7 @@ exports.transformFiles = transformFiles;
|
|
|
105
105
|
|
|
106
106
|
/***/ }),
|
|
107
107
|
|
|
108
|
-
/***/
|
|
108
|
+
/***/ 1272:
|
|
109
109
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
110
110
|
|
|
111
111
|
"use strict";
|
|
@@ -116,7 +116,7 @@ const fs_1 = __nccwpck_require__(7147);
|
|
|
116
116
|
const path_1 = __nccwpck_require__(1017);
|
|
117
117
|
const tapable_1 = __nccwpck_require__(4260);
|
|
118
118
|
const webpack_sources_1 = __nccwpck_require__(5433);
|
|
119
|
-
const helpers_1 = __nccwpck_require__(
|
|
119
|
+
const helpers_1 = __nccwpck_require__(8176);
|
|
120
120
|
const compilerHookMap = new WeakMap();
|
|
121
121
|
const getCompilerHooks = (compiler) => {
|
|
122
122
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -7751,7 +7751,7 @@ var exports = __webpack_exports__;
|
|
|
7751
7751
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7752
7752
|
exports.RspackManifestPlugin = exports.WebpackManifestPlugin = exports.getCompilerHooks = void 0;
|
|
7753
7753
|
const path_1 = __nccwpck_require__(1017);
|
|
7754
|
-
const hooks_1 = __nccwpck_require__(
|
|
7754
|
+
const hooks_1 = __nccwpck_require__(1272);
|
|
7755
7755
|
Object.defineProperty(exports, "getCompilerHooks", ({ enumerable: true, get: function () { return hooks_1.getCompilerHooks; } }));
|
|
7756
7756
|
const emitCountMap = new Map();
|
|
7757
7757
|
const defaults = {
|
package/dist/client/hmr.js
CHANGED
|
@@ -14,6 +14,22 @@ function resolveFileName(stats) {
|
|
|
14
14
|
return `File: ${stats.moduleName}
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
17
|
+
function hintUnknownFiles(message) {
|
|
18
|
+
const hint = "You may need an appropriate loader to handle this file type.";
|
|
19
|
+
if (message.indexOf(hint) === -1) {
|
|
20
|
+
return message;
|
|
21
|
+
}
|
|
22
|
+
if (/File: .+\.s(c|a)ss/.test(message)) {
|
|
23
|
+
return message.replace(hint, `To enable support for Sass, use "@rsbuild/plugin-sass".`);
|
|
24
|
+
}
|
|
25
|
+
if (/File: .+\.less/.test(message)) {
|
|
26
|
+
return message.replace(hint, `To enable support for Less, use "@rsbuild/plugin-less".`);
|
|
27
|
+
}
|
|
28
|
+
if (/File: .+\.styl(us)?/.test(message)) {
|
|
29
|
+
return message.replace(hint, `To enable support for Stylus, use "@rsbuild/plugin-stylus".`);
|
|
30
|
+
}
|
|
31
|
+
return message;
|
|
32
|
+
}
|
|
17
33
|
function formatMessage(stats) {
|
|
18
34
|
let lines = [];
|
|
19
35
|
let message;
|
|
@@ -29,6 +45,7 @@ ${stats.stack}` : "";
|
|
|
29
45
|
} else {
|
|
30
46
|
message = stats;
|
|
31
47
|
}
|
|
48
|
+
message = hintUnknownFiles(message);
|
|
32
49
|
lines = message.split("\n");
|
|
33
50
|
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim());
|
|
34
51
|
message = lines.join("\n");
|
package/dist/index.cjs
CHANGED
|
@@ -68,6 +68,31 @@ function resolveFileName(stats) {
|
|
|
68
68
|
return `File: ${stats.moduleName}
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
|
+
function hintUnknownFiles(message) {
|
|
72
|
+
const hint = "You may need an appropriate loader to handle this file type.";
|
|
73
|
+
if (message.indexOf(hint) === -1) {
|
|
74
|
+
return message;
|
|
75
|
+
}
|
|
76
|
+
if (/File: .+\.s(c|a)ss/.test(message)) {
|
|
77
|
+
return message.replace(
|
|
78
|
+
hint,
|
|
79
|
+
`To enable support for Sass, use "@rsbuild/plugin-sass".`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (/File: .+\.less/.test(message)) {
|
|
83
|
+
return message.replace(
|
|
84
|
+
hint,
|
|
85
|
+
`To enable support for Less, use "@rsbuild/plugin-less".`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (/File: .+\.styl(us)?/.test(message)) {
|
|
89
|
+
return message.replace(
|
|
90
|
+
hint,
|
|
91
|
+
`To enable support for Stylus, use "@rsbuild/plugin-stylus".`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return message;
|
|
95
|
+
}
|
|
71
96
|
function formatMessage(stats) {
|
|
72
97
|
let lines = [];
|
|
73
98
|
let message;
|
|
@@ -83,6 +108,7 @@ ${stats.stack}` : "";
|
|
|
83
108
|
} else {
|
|
84
109
|
message = stats;
|
|
85
110
|
}
|
|
111
|
+
message = hintUnknownFiles(message);
|
|
86
112
|
lines = message.split("\n");
|
|
87
113
|
lines = lines.filter(
|
|
88
114
|
(line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
|
|
@@ -106,7 +132,7 @@ var init_format = __esm({
|
|
|
106
132
|
|
|
107
133
|
// src/helpers.ts
|
|
108
134
|
function formatErrorMessage(errors) {
|
|
109
|
-
const messages = errors.map((error) =>
|
|
135
|
+
const messages = errors.map((error) => hintNodePolyfill(error));
|
|
110
136
|
const text = `${messages.join("\n\n")}
|
|
111
137
|
`;
|
|
112
138
|
const isTerserError = text.includes("from Terser");
|
|
@@ -165,7 +191,7 @@ function formatStats(stats, options = {}) {
|
|
|
165
191
|
async function isFileExists(file) {
|
|
166
192
|
return import_shared2.fse.promises.access(file, import_shared2.fse.constants.F_OK).then(() => true).catch(() => false);
|
|
167
193
|
}
|
|
168
|
-
var import_node_path2, import_shared, import_shared2, rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath,
|
|
194
|
+
var import_node_path2, import_shared, import_shared2, rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
|
|
169
195
|
var init_helpers = __esm({
|
|
170
196
|
"src/helpers.ts"() {
|
|
171
197
|
"use strict";
|
|
@@ -202,7 +228,7 @@ var init_helpers = __esm({
|
|
|
202
228
|
return true;
|
|
203
229
|
};
|
|
204
230
|
getCompiledPath = (packageName) => import_node_path2.default.join(COMPILED_PATH, packageName);
|
|
205
|
-
|
|
231
|
+
hintNodePolyfill = (message) => {
|
|
206
232
|
if (!message.includes(`Can't resolve`)) {
|
|
207
233
|
return message;
|
|
208
234
|
}
|
|
@@ -1040,7 +1066,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
1040
1066
|
const context = {
|
|
1041
1067
|
entry: getEntryObject(config, "web"),
|
|
1042
1068
|
targets: config.output?.targets || [],
|
|
1043
|
-
version: "0.7.0-beta.
|
|
1069
|
+
version: "0.7.0-beta.9",
|
|
1044
1070
|
rootPath,
|
|
1045
1071
|
distPath,
|
|
1046
1072
|
cachePath,
|
|
@@ -2256,11 +2282,12 @@ var init_css = __esm({
|
|
|
2256
2282
|
);
|
|
2257
2283
|
return cssLoaderOptions;
|
|
2258
2284
|
};
|
|
2259
|
-
pluginCss = () => {
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2285
|
+
pluginCss = () => ({
|
|
2286
|
+
name: "rsbuild:css",
|
|
2287
|
+
setup(api) {
|
|
2288
|
+
api.modifyBundlerChain({
|
|
2289
|
+
order: "pre",
|
|
2290
|
+
handler: async (chain, utils) => {
|
|
2264
2291
|
const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
|
|
2265
2292
|
const config = api.getNormalizedConfig();
|
|
2266
2293
|
rule.test(CSS_REGEX);
|
|
@@ -2270,14 +2297,14 @@ var init_css = __esm({
|
|
|
2270
2297
|
config,
|
|
2271
2298
|
context: api.context
|
|
2272
2299
|
});
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
api.modifyRspackConfig(async (rspackConfig) => {
|
|
2303
|
+
rspackConfig.experiments || (rspackConfig.experiments = {});
|
|
2304
|
+
rspackConfig.experiments.css = false;
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2281
2308
|
}
|
|
2282
2309
|
});
|
|
2283
2310
|
|
|
@@ -5692,13 +5719,29 @@ var createHttpServer;
|
|
|
5692
5719
|
var init_httpServer = __esm({
|
|
5693
5720
|
"src/server/httpServer.ts"() {
|
|
5694
5721
|
"use strict";
|
|
5695
|
-
createHttpServer = async (
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5722
|
+
createHttpServer = async ({
|
|
5723
|
+
serverConfig,
|
|
5724
|
+
middlewares
|
|
5725
|
+
}) => {
|
|
5726
|
+
if (serverConfig.https) {
|
|
5727
|
+
if (serverConfig.proxy) {
|
|
5728
|
+
const { createServer: createServer2 } = await import("https");
|
|
5729
|
+
return createServer2(serverConfig.https, middlewares);
|
|
5730
|
+
}
|
|
5731
|
+
const { createSecureServer } = await import("http2");
|
|
5732
|
+
return createSecureServer(
|
|
5733
|
+
{
|
|
5734
|
+
allowHTTP1: true,
|
|
5735
|
+
// increase the maximum memory (MiB)
|
|
5736
|
+
maxSessionMemory: 1024,
|
|
5737
|
+
...serverConfig.https
|
|
5738
|
+
},
|
|
5739
|
+
// @ts-expect-error req type mismatch
|
|
5740
|
+
middlewares
|
|
5741
|
+
);
|
|
5699
5742
|
}
|
|
5700
5743
|
const { createServer } = await import("http");
|
|
5701
|
-
return createServer(
|
|
5744
|
+
return createServer(middlewares);
|
|
5702
5745
|
};
|
|
5703
5746
|
}
|
|
5704
5747
|
});
|
|
@@ -6114,7 +6157,7 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
6114
6157
|
outputFileSystem,
|
|
6115
6158
|
listen: async () => {
|
|
6116
6159
|
const httpServer = await createHttpServer({
|
|
6117
|
-
|
|
6160
|
+
serverConfig,
|
|
6118
6161
|
middlewares
|
|
6119
6162
|
});
|
|
6120
6163
|
(0, import_shared53.debug)("listen dev server");
|
|
@@ -6205,7 +6248,7 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
|
6205
6248
|
});
|
|
6206
6249
|
await context.hooks.onBeforeStartProdServer.call();
|
|
6207
6250
|
const httpServer = await createHttpServer({
|
|
6208
|
-
|
|
6251
|
+
serverConfig,
|
|
6209
6252
|
middlewares: server.middlewares
|
|
6210
6253
|
});
|
|
6211
6254
|
await server.onInit(httpServer);
|
|
@@ -6765,7 +6808,7 @@ var applyServerOptions = (command) => {
|
|
|
6765
6808
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
6766
6809
|
};
|
|
6767
6810
|
function runCli() {
|
|
6768
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.
|
|
6811
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.9");
|
|
6769
6812
|
const devCommand = import_commander.program.command("dev");
|
|
6770
6813
|
const buildCommand = import_commander.program.command("build");
|
|
6771
6814
|
const previewCommand = import_commander.program.command("preview");
|
|
@@ -6845,7 +6888,7 @@ function prepareCli() {
|
|
|
6845
6888
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
6846
6889
|
console.log();
|
|
6847
6890
|
}
|
|
6848
|
-
import_shared60.logger.greet(` ${`Rsbuild v${"0.7.0-beta.
|
|
6891
|
+
import_shared60.logger.greet(` ${`Rsbuild v${"0.7.0-beta.9"}`}
|
|
6849
6892
|
`);
|
|
6850
6893
|
}
|
|
6851
6894
|
|
|
@@ -6876,7 +6919,7 @@ init_config();
|
|
|
6876
6919
|
var import_shared61 = require("@rsbuild/shared");
|
|
6877
6920
|
init_mergeConfig();
|
|
6878
6921
|
init_constants();
|
|
6879
|
-
var version = "0.7.0-beta.
|
|
6922
|
+
var version = "0.7.0-beta.9";
|
|
6880
6923
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6881
6924
|
0 && (module.exports = {
|
|
6882
6925
|
PLUGIN_CSS_NAME,
|
package/dist/index.js
CHANGED
|
@@ -71,6 +71,31 @@ function resolveFileName(stats) {
|
|
|
71
71
|
return `File: ${stats.moduleName}
|
|
72
72
|
`;
|
|
73
73
|
}
|
|
74
|
+
function hintUnknownFiles(message) {
|
|
75
|
+
const hint = "You may need an appropriate loader to handle this file type.";
|
|
76
|
+
if (message.indexOf(hint) === -1) {
|
|
77
|
+
return message;
|
|
78
|
+
}
|
|
79
|
+
if (/File: .+\.s(c|a)ss/.test(message)) {
|
|
80
|
+
return message.replace(
|
|
81
|
+
hint,
|
|
82
|
+
`To enable support for Sass, use "@rsbuild/plugin-sass".`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
if (/File: .+\.less/.test(message)) {
|
|
86
|
+
return message.replace(
|
|
87
|
+
hint,
|
|
88
|
+
`To enable support for Less, use "@rsbuild/plugin-less".`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (/File: .+\.styl(us)?/.test(message)) {
|
|
92
|
+
return message.replace(
|
|
93
|
+
hint,
|
|
94
|
+
`To enable support for Stylus, use "@rsbuild/plugin-stylus".`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return message;
|
|
98
|
+
}
|
|
74
99
|
function formatMessage(stats) {
|
|
75
100
|
let lines = [];
|
|
76
101
|
let message;
|
|
@@ -86,6 +111,7 @@ ${stats.stack}` : "";
|
|
|
86
111
|
} else {
|
|
87
112
|
message = stats;
|
|
88
113
|
}
|
|
114
|
+
message = hintUnknownFiles(message);
|
|
89
115
|
lines = message.split("\n");
|
|
90
116
|
lines = lines.filter(
|
|
91
117
|
(line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
|
|
@@ -119,7 +145,7 @@ import {
|
|
|
119
145
|
} from "@rsbuild/shared";
|
|
120
146
|
import { fse } from "@rsbuild/shared";
|
|
121
147
|
function formatErrorMessage(errors) {
|
|
122
|
-
const messages = errors.map((error) =>
|
|
148
|
+
const messages = errors.map((error) => hintNodePolyfill(error));
|
|
123
149
|
const text = `${messages.join("\n\n")}
|
|
124
150
|
`;
|
|
125
151
|
const isTerserError = text.includes("from Terser");
|
|
@@ -178,7 +204,7 @@ function formatStats(stats, options = {}) {
|
|
|
178
204
|
async function isFileExists(file) {
|
|
179
205
|
return fse.promises.access(file, fse.constants.F_OK).then(() => true).catch(() => false);
|
|
180
206
|
}
|
|
181
|
-
var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath,
|
|
207
|
+
var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
|
|
182
208
|
var init_helpers = __esm({
|
|
183
209
|
"src/helpers.ts"() {
|
|
184
210
|
"use strict";
|
|
@@ -213,7 +239,7 @@ var init_helpers = __esm({
|
|
|
213
239
|
return true;
|
|
214
240
|
};
|
|
215
241
|
getCompiledPath = (packageName) => path2.join(COMPILED_PATH, packageName);
|
|
216
|
-
|
|
242
|
+
hintNodePolyfill = (message) => {
|
|
217
243
|
if (!message.includes(`Can't resolve`)) {
|
|
218
244
|
return message;
|
|
219
245
|
}
|
|
@@ -1092,7 +1118,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
1092
1118
|
const context = {
|
|
1093
1119
|
entry: getEntryObject(config, "web"),
|
|
1094
1120
|
targets: config.output?.targets || [],
|
|
1095
|
-
version: "0.7.0-beta.
|
|
1121
|
+
version: "0.7.0-beta.9",
|
|
1096
1122
|
rootPath,
|
|
1097
1123
|
distPath,
|
|
1098
1124
|
cachePath,
|
|
@@ -2343,11 +2369,12 @@ var init_css = __esm({
|
|
|
2343
2369
|
);
|
|
2344
2370
|
return cssLoaderOptions;
|
|
2345
2371
|
};
|
|
2346
|
-
pluginCss = () => {
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2372
|
+
pluginCss = () => ({
|
|
2373
|
+
name: "rsbuild:css",
|
|
2374
|
+
setup(api) {
|
|
2375
|
+
api.modifyBundlerChain({
|
|
2376
|
+
order: "pre",
|
|
2377
|
+
handler: async (chain, utils) => {
|
|
2351
2378
|
const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
|
|
2352
2379
|
const config = api.getNormalizedConfig();
|
|
2353
2380
|
rule.test(CSS_REGEX);
|
|
@@ -2357,14 +2384,14 @@ var init_css = __esm({
|
|
|
2357
2384
|
config,
|
|
2358
2385
|
context: api.context
|
|
2359
2386
|
});
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
};
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2389
|
+
api.modifyRspackConfig(async (rspackConfig) => {
|
|
2390
|
+
rspackConfig.experiments || (rspackConfig.experiments = {});
|
|
2391
|
+
rspackConfig.experiments.css = false;
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2368
2395
|
}
|
|
2369
2396
|
});
|
|
2370
2397
|
|
|
@@ -5915,13 +5942,29 @@ var init_httpServer = __esm({
|
|
|
5915
5942
|
"src/server/httpServer.ts"() {
|
|
5916
5943
|
"use strict";
|
|
5917
5944
|
init_esm();
|
|
5918
|
-
createHttpServer = async (
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5945
|
+
createHttpServer = async ({
|
|
5946
|
+
serverConfig,
|
|
5947
|
+
middlewares
|
|
5948
|
+
}) => {
|
|
5949
|
+
if (serverConfig.https) {
|
|
5950
|
+
if (serverConfig.proxy) {
|
|
5951
|
+
const { createServer: createServer2 } = await import("https");
|
|
5952
|
+
return createServer2(serverConfig.https, middlewares);
|
|
5953
|
+
}
|
|
5954
|
+
const { createSecureServer } = await import("http2");
|
|
5955
|
+
return createSecureServer(
|
|
5956
|
+
{
|
|
5957
|
+
allowHTTP1: true,
|
|
5958
|
+
// increase the maximum memory (MiB)
|
|
5959
|
+
maxSessionMemory: 1024,
|
|
5960
|
+
...serverConfig.https
|
|
5961
|
+
},
|
|
5962
|
+
// @ts-expect-error req type mismatch
|
|
5963
|
+
middlewares
|
|
5964
|
+
);
|
|
5922
5965
|
}
|
|
5923
5966
|
const { createServer } = await import("http");
|
|
5924
|
-
return createServer(
|
|
5967
|
+
return createServer(middlewares);
|
|
5925
5968
|
};
|
|
5926
5969
|
}
|
|
5927
5970
|
});
|
|
@@ -6350,7 +6393,7 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
6350
6393
|
outputFileSystem,
|
|
6351
6394
|
listen: async () => {
|
|
6352
6395
|
const httpServer = await createHttpServer({
|
|
6353
|
-
|
|
6396
|
+
serverConfig,
|
|
6354
6397
|
middlewares
|
|
6355
6398
|
});
|
|
6356
6399
|
debug7("listen dev server");
|
|
@@ -6447,7 +6490,7 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
|
6447
6490
|
});
|
|
6448
6491
|
await context.hooks.onBeforeStartProdServer.call();
|
|
6449
6492
|
const httpServer = await createHttpServer({
|
|
6450
|
-
|
|
6493
|
+
serverConfig,
|
|
6451
6494
|
middlewares: server.middlewares
|
|
6452
6495
|
});
|
|
6453
6496
|
await server.onInit(httpServer);
|
|
@@ -7001,7 +7044,7 @@ var applyServerOptions = (command) => {
|
|
|
7001
7044
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
7002
7045
|
};
|
|
7003
7046
|
function runCli() {
|
|
7004
|
-
program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.
|
|
7047
|
+
program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.9");
|
|
7005
7048
|
const devCommand = program.command("dev");
|
|
7006
7049
|
const buildCommand = program.command("build");
|
|
7007
7050
|
const previewCommand = program.command("preview");
|
|
@@ -7082,7 +7125,7 @@ function prepareCli() {
|
|
|
7082
7125
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
7083
7126
|
console.log();
|
|
7084
7127
|
}
|
|
7085
|
-
logger18.greet(` ${`Rsbuild v${"0.7.0-beta.
|
|
7128
|
+
logger18.greet(` ${`Rsbuild v${"0.7.0-beta.9"}`}
|
|
7086
7129
|
`);
|
|
7087
7130
|
}
|
|
7088
7131
|
|
|
@@ -7114,7 +7157,7 @@ init_config();
|
|
|
7114
7157
|
init_mergeConfig();
|
|
7115
7158
|
init_constants();
|
|
7116
7159
|
import { logger as logger19 } from "@rsbuild/shared";
|
|
7117
|
-
var version = "0.7.0-beta.
|
|
7160
|
+
var version = "0.7.0-beta.9";
|
|
7118
7161
|
export {
|
|
7119
7162
|
PLUGIN_CSS_NAME,
|
|
7120
7163
|
PLUGIN_SWC_NAME,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import type { ServerConfig } from '@rsbuild/shared';
|
|
4
5
|
import type connect from '@rsbuild/shared/connect';
|
|
5
|
-
export declare const createHttpServer: (
|
|
6
|
-
|
|
6
|
+
export declare const createHttpServer: ({ serverConfig, middlewares, }: {
|
|
7
|
+
serverConfig: ServerConfig;
|
|
7
8
|
middlewares: connect.Server;
|
|
8
|
-
}) => Promise<import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse
|
|
9
|
+
}) => Promise<import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("http2").Http2SecureServer>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import type { Server } from 'node:http';
|
|
4
|
+
import type { Http2SecureServer } from 'node:http2';
|
|
3
5
|
import { type PreviewServerOptions, type ServerConfig, type StartServerResult } from '@rsbuild/shared';
|
|
4
6
|
import connect from '@rsbuild/shared/connect';
|
|
5
7
|
import type { InternalContext, NormalizedConfig } from '../types';
|
|
@@ -16,7 +18,7 @@ export declare class RsbuildProdServer {
|
|
|
16
18
|
private options;
|
|
17
19
|
middlewares: connect.Server;
|
|
18
20
|
constructor(options: RsbuildProdServerOptions);
|
|
19
|
-
onInit(app: Server): Promise<void>;
|
|
21
|
+
onInit(app: Server | Http2SecureServer): Promise<void>;
|
|
20
22
|
private applyDefaultMiddlewares;
|
|
21
23
|
private applyStaticAssetMiddleware;
|
|
22
24
|
close(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.9",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "0.7.0-beta.
|
|
49
|
+
"@rspack/core": "0.7.0-beta.2",
|
|
50
50
|
"@swc/helpers": "0.5.3",
|
|
51
51
|
"core-js": "~3.36.0",
|
|
52
52
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.7.2",
|
|
53
53
|
"postcss": "^8.4.38",
|
|
54
|
-
"@rsbuild/shared": "0.7.0-beta.
|
|
54
|
+
"@rsbuild/shared": "0.7.0-beta.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/fs-extra": "^11.0.4",
|