@rsbuild/core 0.7.0-beta.7 → 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.
@@ -1,19 +1,19 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 7067:
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__(2649);
10
+ const loader = __nccwpck_require__(3898);
11
11
  module.exports = loader.default;
12
- module.exports.defaultGetLocalIdent = __nccwpck_require__(9281).defaultGetLocalIdent;
12
+ module.exports.defaultGetLocalIdent = __nccwpck_require__(6313).defaultGetLocalIdent;
13
13
 
14
14
  /***/ }),
15
15
 
16
- /***/ 2649:
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__(4231));
30
- var _plugins = __nccwpck_require__(4476);
31
- var _utils = __nccwpck_require__(9281);
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
- /***/ 4476:
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__(6929));
242
- var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(2042));
243
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(7811));
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
- /***/ 2042:
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__(9281);
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
- /***/ 6929:
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__(9281);
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
- /***/ 7811:
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__(9281);
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
- /***/ 9281:
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
- /***/ 4231:
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__(7067);
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
- /***/ 4925:
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__(1025)["default"];
7711
+ module.exports = __nccwpck_require__(9089)["default"];
7712
7712
 
7713
7713
  /***/ }),
7714
7714
 
7715
- /***/ 1025:
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__(2901));
7729
- var _utils = __nccwpck_require__(4368);
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
- /***/ 4368:
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
- /***/ 2901:
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__(4925);
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
- /***/ 352:
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
- /***/ 8234:
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__(352);
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__(8234);
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 = {
@@ -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
@@ -36,16 +36,13 @@ var __publicField = (obj, key, value) => {
36
36
  };
37
37
 
38
38
  // src/constants.ts
39
- var import_node_path, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, PLUGIN_LESS_NAME, PLUGIN_SASS_NAME, PLUGIN_STYLUS_NAME, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HTML_REGEX, CSS_REGEX;
39
+ var import_node_path, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HTML_REGEX, CSS_REGEX;
40
40
  var init_constants = __esm({
41
41
  "src/constants.ts"() {
42
42
  "use strict";
43
43
  import_node_path = require("path");
44
44
  PLUGIN_SWC_NAME = "rsbuild:swc";
45
45
  PLUGIN_CSS_NAME = "rsbuild:css";
46
- PLUGIN_LESS_NAME = "rsbuild:less";
47
- PLUGIN_SASS_NAME = "rsbuild:sass";
48
- PLUGIN_STYLUS_NAME = "rsbuild:stylus";
49
46
  LOADER_PATH = (0, import_node_path.join)(__dirname);
50
47
  STATIC_PATH = (0, import_node_path.join)(__dirname, "../static");
51
48
  COMPILED_PATH = (0, import_node_path.join)(__dirname, "../compiled");
@@ -71,6 +68,31 @@ function resolveFileName(stats) {
71
68
  return `File: ${stats.moduleName}
72
69
  `;
73
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
+ }
74
96
  function formatMessage(stats) {
75
97
  let lines = [];
76
98
  let message;
@@ -86,6 +108,7 @@ ${stats.stack}` : "";
86
108
  } else {
87
109
  message = stats;
88
110
  }
111
+ message = hintUnknownFiles(message);
89
112
  lines = message.split("\n");
90
113
  lines = lines.filter(
91
114
  (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
@@ -109,7 +132,7 @@ var init_format = __esm({
109
132
 
110
133
  // src/helpers.ts
111
134
  function formatErrorMessage(errors) {
112
- const messages = errors.map((error) => addNodePolyfillTip(error));
135
+ const messages = errors.map((error) => hintNodePolyfill(error));
113
136
  const text = `${messages.join("\n\n")}
114
137
  `;
115
138
  const isTerserError = text.includes("from Terser");
@@ -168,7 +191,7 @@ function formatStats(stats, options = {}) {
168
191
  async function isFileExists(file) {
169
192
  return import_shared2.fse.promises.access(file, import_shared2.fse.constants.F_OK).then(() => true).catch(() => false);
170
193
  }
171
- var import_node_path2, import_shared, import_shared2, rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, addNodePolyfillTip, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
194
+ var import_node_path2, import_shared, import_shared2, rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
172
195
  var init_helpers = __esm({
173
196
  "src/helpers.ts"() {
174
197
  "use strict";
@@ -205,7 +228,7 @@ var init_helpers = __esm({
205
228
  return true;
206
229
  };
207
230
  getCompiledPath = (packageName) => import_node_path2.default.join(COMPILED_PATH, packageName);
208
- addNodePolyfillTip = (message) => {
231
+ hintNodePolyfill = (message) => {
209
232
  if (!message.includes(`Can't resolve`)) {
210
233
  return message;
211
234
  }
@@ -1043,7 +1066,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
1043
1066
  const context = {
1044
1067
  entry: getEntryObject(config, "web"),
1045
1068
  targets: config.output?.targets || [],
1046
- version: "0.7.0-beta.7",
1069
+ version: "0.7.0-beta.9",
1047
1070
  rootPath,
1048
1071
  distPath,
1049
1072
  cachePath,
@@ -2064,7 +2087,6 @@ var init_html = __esm({
2064
2087
  var css_exports = {};
2065
2088
  __export(css_exports, {
2066
2089
  applyAutoprefixer: () => applyAutoprefixer,
2067
- applyCSSRule: () => applyCSSRule,
2068
2090
  enableNativeCss: () => enableNativeCss,
2069
2091
  isUseCssExtract: () => isUseCssExtract,
2070
2092
  normalizeCssLoaderOptions: () => normalizeCssLoaderOptions,
@@ -2260,11 +2282,12 @@ var init_css = __esm({
2260
2282
  );
2261
2283
  return cssLoaderOptions;
2262
2284
  };
2263
- pluginCss = () => {
2264
- return {
2265
- name: "rsbuild:css",
2266
- setup(api) {
2267
- api.modifyBundlerChain(async (chain, utils) => {
2285
+ pluginCss = () => ({
2286
+ name: "rsbuild:css",
2287
+ setup(api) {
2288
+ api.modifyBundlerChain({
2289
+ order: "pre",
2290
+ handler: async (chain, utils) => {
2268
2291
  const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
2269
2292
  const config = api.getNormalizedConfig();
2270
2293
  rule.test(CSS_REGEX);
@@ -2274,14 +2297,14 @@ var init_css = __esm({
2274
2297
  config,
2275
2298
  context: api.context
2276
2299
  });
2277
- });
2278
- api.modifyRspackConfig(async (rspackConfig) => {
2279
- rspackConfig.experiments || (rspackConfig.experiments = {});
2280
- rspackConfig.experiments.css = false;
2281
- });
2282
- }
2283
- };
2284
- };
2300
+ }
2301
+ });
2302
+ api.modifyRspackConfig(async (rspackConfig) => {
2303
+ rspackConfig.experiments || (rspackConfig.experiments = {});
2304
+ rspackConfig.experiments.css = false;
2305
+ });
2306
+ }
2307
+ });
2285
2308
  }
2286
2309
  });
2287
2310
 
@@ -5696,13 +5719,29 @@ var createHttpServer;
5696
5719
  var init_httpServer = __esm({
5697
5720
  "src/server/httpServer.ts"() {
5698
5721
  "use strict";
5699
- createHttpServer = async (options) => {
5700
- if (options.https) {
5701
- const { createServer: createServer2 } = await import("https");
5702
- return createServer2(options.https, options.middlewares);
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
+ );
5703
5742
  }
5704
5743
  const { createServer } = await import("http");
5705
- return createServer(options.middlewares);
5744
+ return createServer(middlewares);
5706
5745
  };
5707
5746
  }
5708
5747
  });
@@ -6118,7 +6157,7 @@ async function createDevServer(options, createDevMiddleware2, config, {
6118
6157
  outputFileSystem,
6119
6158
  listen: async () => {
6120
6159
  const httpServer = await createHttpServer({
6121
- https: serverConfig.https,
6160
+ serverConfig,
6122
6161
  middlewares
6123
6162
  });
6124
6163
  (0, import_shared53.debug)("listen dev server");
@@ -6209,7 +6248,7 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
6209
6248
  });
6210
6249
  await context.hooks.onBeforeStartProdServer.call();
6211
6250
  const httpServer = await createHttpServer({
6212
- https: serverConfig.https,
6251
+ serverConfig,
6213
6252
  middlewares: server.middlewares
6214
6253
  });
6215
6254
  await server.onInit(httpServer);
@@ -6710,9 +6749,6 @@ var init_init = __esm({
6710
6749
  var src_exports = {};
6711
6750
  __export(src_exports, {
6712
6751
  PLUGIN_CSS_NAME: () => PLUGIN_CSS_NAME,
6713
- PLUGIN_LESS_NAME: () => PLUGIN_LESS_NAME,
6714
- PLUGIN_SASS_NAME: () => PLUGIN_SASS_NAME,
6715
- PLUGIN_STYLUS_NAME: () => PLUGIN_STYLUS_NAME,
6716
6752
  PLUGIN_SWC_NAME: () => PLUGIN_SWC_NAME,
6717
6753
  __internalHelper: () => internal_exports,
6718
6754
  createRsbuild: () => createRsbuild,
@@ -6730,7 +6766,6 @@ var import_core10 = require("@rspack/core");
6730
6766
  // src/internal.ts
6731
6767
  var internal_exports = {};
6732
6768
  __export(internal_exports, {
6733
- applyCSSRule: () => applyCSSRule,
6734
6769
  applySwcDecoratorConfig: () => applySwcDecoratorConfig,
6735
6770
  createContext: () => createContext,
6736
6771
  createDevServer: () => createDevServer,
@@ -6773,7 +6808,7 @@ var applyServerOptions = (command) => {
6773
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");
6774
6809
  };
6775
6810
  function runCli() {
6776
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.7");
6811
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.9");
6777
6812
  const devCommand = import_commander.program.command("dev");
6778
6813
  const buildCommand = import_commander.program.command("build");
6779
6814
  const previewCommand = import_commander.program.command("preview");
@@ -6853,7 +6888,7 @@ function prepareCli() {
6853
6888
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
6854
6889
  console.log();
6855
6890
  }
6856
- import_shared60.logger.greet(` ${`Rsbuild v${"0.7.0-beta.7"}`}
6891
+ import_shared60.logger.greet(` ${`Rsbuild v${"0.7.0-beta.9"}`}
6857
6892
  `);
6858
6893
  }
6859
6894
 
@@ -6862,7 +6897,6 @@ init_createContext();
6862
6897
  init_pluginManager();
6863
6898
  init_initHooks();
6864
6899
  init_initConfigs();
6865
- init_css();
6866
6900
  init_initPlugins();
6867
6901
  init_pluginHelper();
6868
6902
  init_helpers();
@@ -6885,13 +6919,10 @@ init_config();
6885
6919
  var import_shared61 = require("@rsbuild/shared");
6886
6920
  init_mergeConfig();
6887
6921
  init_constants();
6888
- var version = "0.7.0-beta.7";
6922
+ var version = "0.7.0-beta.9";
6889
6923
  // Annotate the CommonJS export names for ESM import in node:
6890
6924
  0 && (module.exports = {
6891
6925
  PLUGIN_CSS_NAME,
6892
- PLUGIN_LESS_NAME,
6893
- PLUGIN_SASS_NAME,
6894
- PLUGIN_STYLUS_NAME,
6895
6926
  PLUGIN_SWC_NAME,
6896
6927
  __internalHelper,
6897
6928
  createRsbuild,
package/dist/index.js CHANGED
@@ -39,16 +39,13 @@ var init_esm = __esm({
39
39
 
40
40
  // src/constants.ts
41
41
  import { join } from "path";
42
- var PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, PLUGIN_LESS_NAME, PLUGIN_SASS_NAME, PLUGIN_STYLUS_NAME, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HTML_REGEX, CSS_REGEX;
42
+ var PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HTML_REGEX, CSS_REGEX;
43
43
  var init_constants = __esm({
44
44
  "src/constants.ts"() {
45
45
  "use strict";
46
46
  init_esm();
47
47
  PLUGIN_SWC_NAME = "rsbuild:swc";
48
48
  PLUGIN_CSS_NAME = "rsbuild:css";
49
- PLUGIN_LESS_NAME = "rsbuild:less";
50
- PLUGIN_SASS_NAME = "rsbuild:sass";
51
- PLUGIN_STYLUS_NAME = "rsbuild:stylus";
52
49
  LOADER_PATH = join(__dirname);
53
50
  STATIC_PATH = join(__dirname, "../static");
54
51
  COMPILED_PATH = join(__dirname, "../compiled");
@@ -74,6 +71,31 @@ function resolveFileName(stats) {
74
71
  return `File: ${stats.moduleName}
75
72
  `;
76
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
+ }
77
99
  function formatMessage(stats) {
78
100
  let lines = [];
79
101
  let message;
@@ -89,6 +111,7 @@ ${stats.stack}` : "";
89
111
  } else {
90
112
  message = stats;
91
113
  }
114
+ message = hintUnknownFiles(message);
92
115
  lines = message.split("\n");
93
116
  lines = lines.filter(
94
117
  (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
@@ -122,7 +145,7 @@ import {
122
145
  } from "@rsbuild/shared";
123
146
  import { fse } from "@rsbuild/shared";
124
147
  function formatErrorMessage(errors) {
125
- const messages = errors.map((error) => addNodePolyfillTip(error));
148
+ const messages = errors.map((error) => hintNodePolyfill(error));
126
149
  const text = `${messages.join("\n\n")}
127
150
  `;
128
151
  const isTerserError = text.includes("from Terser");
@@ -181,7 +204,7 @@ function formatStats(stats, options = {}) {
181
204
  async function isFileExists(file) {
182
205
  return fse.promises.access(file, fse.constants.F_OK).then(() => true).catch(() => false);
183
206
  }
184
- var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, addNodePolyfillTip, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
207
+ var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
185
208
  var init_helpers = __esm({
186
209
  "src/helpers.ts"() {
187
210
  "use strict";
@@ -216,7 +239,7 @@ var init_helpers = __esm({
216
239
  return true;
217
240
  };
218
241
  getCompiledPath = (packageName) => path2.join(COMPILED_PATH, packageName);
219
- addNodePolyfillTip = (message) => {
242
+ hintNodePolyfill = (message) => {
220
243
  if (!message.includes(`Can't resolve`)) {
221
244
  return message;
222
245
  }
@@ -1095,7 +1118,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
1095
1118
  const context = {
1096
1119
  entry: getEntryObject(config, "web"),
1097
1120
  targets: config.output?.targets || [],
1098
- version: "0.7.0-beta.7",
1121
+ version: "0.7.0-beta.9",
1099
1122
  rootPath,
1100
1123
  distPath,
1101
1124
  cachePath,
@@ -2144,7 +2167,6 @@ var init_html = __esm({
2144
2167
  var css_exports = {};
2145
2168
  __export(css_exports, {
2146
2169
  applyAutoprefixer: () => applyAutoprefixer,
2147
- applyCSSRule: () => applyCSSRule,
2148
2170
  enableNativeCss: () => enableNativeCss,
2149
2171
  isUseCssExtract: () => isUseCssExtract,
2150
2172
  normalizeCssLoaderOptions: () => normalizeCssLoaderOptions,
@@ -2347,11 +2369,12 @@ var init_css = __esm({
2347
2369
  );
2348
2370
  return cssLoaderOptions;
2349
2371
  };
2350
- pluginCss = () => {
2351
- return {
2352
- name: "rsbuild:css",
2353
- setup(api) {
2354
- api.modifyBundlerChain(async (chain, utils) => {
2372
+ pluginCss = () => ({
2373
+ name: "rsbuild:css",
2374
+ setup(api) {
2375
+ api.modifyBundlerChain({
2376
+ order: "pre",
2377
+ handler: async (chain, utils) => {
2355
2378
  const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
2356
2379
  const config = api.getNormalizedConfig();
2357
2380
  rule.test(CSS_REGEX);
@@ -2361,14 +2384,14 @@ var init_css = __esm({
2361
2384
  config,
2362
2385
  context: api.context
2363
2386
  });
2364
- });
2365
- api.modifyRspackConfig(async (rspackConfig) => {
2366
- rspackConfig.experiments || (rspackConfig.experiments = {});
2367
- rspackConfig.experiments.css = false;
2368
- });
2369
- }
2370
- };
2371
- };
2387
+ }
2388
+ });
2389
+ api.modifyRspackConfig(async (rspackConfig) => {
2390
+ rspackConfig.experiments || (rspackConfig.experiments = {});
2391
+ rspackConfig.experiments.css = false;
2392
+ });
2393
+ }
2394
+ });
2372
2395
  }
2373
2396
  });
2374
2397
 
@@ -5919,13 +5942,29 @@ var init_httpServer = __esm({
5919
5942
  "src/server/httpServer.ts"() {
5920
5943
  "use strict";
5921
5944
  init_esm();
5922
- createHttpServer = async (options) => {
5923
- if (options.https) {
5924
- const { createServer: createServer2 } = await import("https");
5925
- return createServer2(options.https, options.middlewares);
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
+ );
5926
5965
  }
5927
5966
  const { createServer } = await import("http");
5928
- return createServer(options.middlewares);
5967
+ return createServer(middlewares);
5929
5968
  };
5930
5969
  }
5931
5970
  });
@@ -6354,7 +6393,7 @@ async function createDevServer(options, createDevMiddleware2, config, {
6354
6393
  outputFileSystem,
6355
6394
  listen: async () => {
6356
6395
  const httpServer = await createHttpServer({
6357
- https: serverConfig.https,
6396
+ serverConfig,
6358
6397
  middlewares
6359
6398
  });
6360
6399
  debug7("listen dev server");
@@ -6451,7 +6490,7 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
6451
6490
  });
6452
6491
  await context.hooks.onBeforeStartProdServer.call();
6453
6492
  const httpServer = await createHttpServer({
6454
- https: serverConfig.https,
6493
+ serverConfig,
6455
6494
  middlewares: server.middlewares
6456
6495
  });
6457
6496
  await server.onInit(httpServer);
@@ -6961,7 +7000,6 @@ import { rspack as rspack10 } from "@rspack/core";
6961
7000
  // src/internal.ts
6962
7001
  var internal_exports = {};
6963
7002
  __export(internal_exports, {
6964
- applyCSSRule: () => applyCSSRule,
6965
7003
  applySwcDecoratorConfig: () => applySwcDecoratorConfig,
6966
7004
  createContext: () => createContext,
6967
7005
  createDevServer: () => createDevServer,
@@ -7006,7 +7044,7 @@ var applyServerOptions = (command) => {
7006
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");
7007
7045
  };
7008
7046
  function runCli() {
7009
- program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.7");
7047
+ program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.9");
7010
7048
  const devCommand = program.command("dev");
7011
7049
  const buildCommand = program.command("build");
7012
7050
  const previewCommand = program.command("preview");
@@ -7087,7 +7125,7 @@ function prepareCli() {
7087
7125
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
7088
7126
  console.log();
7089
7127
  }
7090
- logger18.greet(` ${`Rsbuild v${"0.7.0-beta.7"}`}
7128
+ logger18.greet(` ${`Rsbuild v${"0.7.0-beta.9"}`}
7091
7129
  `);
7092
7130
  }
7093
7131
 
@@ -7096,7 +7134,6 @@ init_createContext();
7096
7134
  init_pluginManager();
7097
7135
  init_initHooks();
7098
7136
  init_initConfigs();
7099
- init_css();
7100
7137
  init_initPlugins();
7101
7138
  init_pluginHelper();
7102
7139
  init_helpers();
@@ -7120,12 +7157,9 @@ init_config();
7120
7157
  init_mergeConfig();
7121
7158
  init_constants();
7122
7159
  import { logger as logger19 } from "@rsbuild/shared";
7123
- var version = "0.7.0-beta.7";
7160
+ var version = "0.7.0-beta.9";
7124
7161
  export {
7125
7162
  PLUGIN_CSS_NAME,
7126
- PLUGIN_LESS_NAME,
7127
- PLUGIN_SASS_NAME,
7128
- PLUGIN_STYLUS_NAME,
7129
7163
  PLUGIN_SWC_NAME,
7130
7164
  internal_exports as __internalHelper,
7131
7165
  createRsbuild,
@@ -1,8 +1,5 @@
1
1
  export declare const PLUGIN_SWC_NAME = "rsbuild:swc";
2
2
  export declare const PLUGIN_CSS_NAME = "rsbuild:css";
3
- export declare const PLUGIN_LESS_NAME = "rsbuild:less";
4
- export declare const PLUGIN_SASS_NAME = "rsbuild:sass";
5
- export declare const PLUGIN_STYLUS_NAME = "rsbuild:stylus";
6
3
  export declare const LOADER_PATH: string;
7
4
  export declare const STATIC_PATH: string;
8
5
  export declare const COMPILED_PATH: string;
@@ -13,7 +13,7 @@ export { rspack };
13
13
  export type { Rspack };
14
14
  export { logger } from '@rsbuild/shared';
15
15
  export { mergeRsbuildConfig } from './mergeConfig';
16
- export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, PLUGIN_SASS_NAME, PLUGIN_LESS_NAME, PLUGIN_STYLUS_NAME, } from './constants';
16
+ export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
17
17
  export type { RsbuildConfig, DevConfig, HtmlConfig, ToolsConfig, SourceConfig, ServerConfig, OutputConfig, SecurityConfig, PerformanceConfig, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedHtmlConfig, NormalizedToolsConfig, NormalizedSourceConfig, NormalizedServerConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig, NormalizedModuleFederationConfig, RsbuildPlugin, RsbuildPlugins, RsbuildPluginAPI, } from './types';
18
18
  export type { RsbuildMode, RsbuildEntry, RsbuildTarget, RsbuildContext, RsbuildInstance, CreateRsbuildOptions, InspectConfigOptions, Minify, Polyfill, PrintUrls, PublicDir, Decorators, RspackRule, WatchFiles, CSSModules, CrossOrigin, ConsoleType, SplitChunks, BundlerChain, ClientConfig, ScriptInject, ChainedConfig, PostCSSPlugin, ScriptLoading, LegalComments, AliasStrategy, FilenameConfig, DistPathConfig, OutputStructure, ChainIdentifier, PreconnectOption, CSSLoaderOptions, ModifyChainUtils, StyleLoaderOptions, PostCSSLoaderOptions, ChainedConfigWithUtils, ModifyRspackConfigUtils, CSSModulesLocalsConvention, OnExitFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnBeforeCreateCompilerFn, OnCloseDevServerFn, OnDevCompileDoneFn, ModifyBundlerChainFn, ModifyRspackConfigFn, ModifyRsbuildConfigFn, TransformFn, TransformHandler, } from '@rsbuild/shared';
19
19
  export {
@@ -9,7 +9,6 @@ export { createContext, createPublicContext } from './createContext';
9
9
  export { initPlugins, createPluginManager } from './pluginManager';
10
10
  export { initHooks, type Hooks } from './initHooks';
11
11
  export { initRsbuildConfig } from './provider/initConfigs';
12
- export { applyCSSRule } from './plugins/css';
13
12
  export { getPluginAPI } from './initPlugins';
14
13
  export type { InternalContext } from './types';
15
14
  export { setHTMLPlugin, getHTMLPlugin, setCssExtractPlugin, } from './pluginHelper';
@@ -1,4 +1,4 @@
1
- import { type BundlerChainRule, type CSSLoaderOptions, type ModifyChainUtils, type RsbuildContext, type RsbuildTarget } from '@rsbuild/shared';
1
+ import { type CSSLoaderOptions, type RsbuildTarget } from '@rsbuild/shared';
2
2
  import type { AcceptedPlugin } from 'postcss';
3
3
  import type { NormalizedConfig, RsbuildPlugin } from '../types';
4
4
  export declare const enableNativeCss: (config: NormalizedConfig) => boolean;
@@ -9,11 +9,4 @@ export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, expo
9
9
  * Check if autoprefixer is already in the plugins, if not, add it
10
10
  */
11
11
  export declare const applyAutoprefixer: (plugins: unknown[], browserslist: string[], config: NormalizedConfig) => Promise<AcceptedPlugin[]>;
12
- export declare function applyCSSRule({ rule, config, context, utils: { target, isProd, CHAIN_ID }, importLoaders, }: {
13
- rule: BundlerChainRule;
14
- config: NormalizedConfig;
15
- context: RsbuildContext;
16
- utils: ModifyChainUtils;
17
- importLoaders?: number;
18
- }): Promise<void>;
19
12
  export declare const pluginCss: () => RsbuildPlugin;
@@ -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: (options: {
6
- https?: ServerConfig['https'];
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.7",
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.1",
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.7"
54
+ "@rsbuild/shared": "0.7.0-beta.9"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/fs-extra": "^11.0.4",