@rsbuild/core 1.3.1 → 1.3.3

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
  (() => {
2
2
  var __webpack_modules__ = {
3
- 210: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 1001: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(6288);
5
+ const loader = __nccwpck_require__(3403);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(6329).defaultGetLocalIdent;
8
+ __nccwpck_require__(7206).defaultGetLocalIdent;
9
9
  },
10
- 6288: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 3403: (__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__(1279);
16
- var _utils = __nccwpck_require__(6329);
15
+ var _plugins = __nccwpck_require__(4456);
16
+ var _utils = __nccwpck_require__(7206);
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
- 1279: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 4456: (__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__(1388),
261
+ __nccwpck_require__(3659),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(7017),
264
+ __nccwpck_require__(6998),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(5632));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9777));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 7017: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 6998: (__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__(4531);
276
- var _utils = __nccwpck_require__(6329);
276
+ var _utils = __nccwpck_require__(7206);
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
- 1388: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 3659: (__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__(6329);
382
+ var _utils = __nccwpck_require__(7206);
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
- 5632: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 9777: (__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__(6329);
694
+ var _utils = __nccwpck_require__(7206);
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
- 6329: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 7206: (__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__(210);
8101
+ var __webpack_exports__ = __nccwpck_require__(1001);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -36,8 +36,6 @@ declare class HtmlRspackPlugin {
36
36
  }
37
37
 
38
38
  declare namespace HtmlRspackPlugin {
39
- type MinifyOptions = HtmlMinifierOptions;
40
-
41
39
  interface Options {
42
40
  /**
43
41
  * Emit the file only if it was changed.
@@ -173,9 +171,7 @@ declare namespace HtmlRspackPlugin {
173
171
  /**
174
172
  * The plugin options after adding default values
175
173
  */
176
- interface ProcessedOptions extends Required<Options> {
177
- minify?: Options['minify'];
178
- }
174
+ interface ProcessedOptions extends Required<Options> {}
179
175
 
180
176
  /**
181
177
  * The values which are available during template execution
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 274: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 386: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(299);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(403);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -304,7 +304,7 @@
304
304
  }
305
305
  module.exports = { CachedChildCompilation };
306
306
  },
307
- 299: (module) => {
307
+ 403: (module) => {
308
308
  "use strict";
309
309
  class HtmlWebpackChildCompiler {
310
310
  constructor(templates) {
@@ -473,7 +473,7 @@
473
473
  }
474
474
  module.exports = { HtmlWebpackChildCompiler };
475
475
  },
476
- 769: (module) => {
476
+ 369: (module) => {
477
477
  "use strict";
478
478
  module.exports = {};
479
479
  module.exports.none = (chunks) => chunks;
@@ -492,7 +492,7 @@
492
492
  };
493
493
  module.exports.auto = module.exports.none;
494
494
  },
495
- 688: (module) => {
495
+ 312: (module) => {
496
496
  "use strict";
497
497
  module.exports = function (err) {
498
498
  return {
@@ -513,7 +513,7 @@
513
513
  };
514
514
  };
515
515
  },
516
- 695: (module, __unused_webpack_exports, __nccwpck_require__) => {
516
+ 575: (module, __unused_webpack_exports, __nccwpck_require__) => {
517
517
  "use strict";
518
518
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
519
519
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -539,7 +539,7 @@
539
539
  }
540
540
  module.exports = { getHtmlRspackPluginHooks };
541
541
  },
542
- 902: (module) => {
542
+ 654: (module) => {
543
543
  const voidTags = [
544
544
  "area",
545
545
  "base",
@@ -607,19 +607,19 @@
607
607
  htmlTagObjectToString,
608
608
  };
609
609
  },
610
- 479: (module, __unused_webpack_exports, __nccwpck_require__) => {
610
+ 535: (module, __unused_webpack_exports, __nccwpck_require__) => {
611
611
  "use strict";
612
612
  const promisify = __nccwpck_require__(23).promisify;
613
613
  const vm = __nccwpck_require__(154);
614
614
  const fs = __nccwpck_require__(896);
615
615
  const path = __nccwpck_require__(928);
616
- const { CachedChildCompilation } = __nccwpck_require__(274);
616
+ const { CachedChildCompilation } = __nccwpck_require__(386);
617
617
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
618
- __nccwpck_require__(902);
619
- const prettyError = __nccwpck_require__(688);
620
- const chunkSorter = __nccwpck_require__(769);
618
+ __nccwpck_require__(654);
619
+ const prettyError = __nccwpck_require__(312);
620
+ const chunkSorter = __nccwpck_require__(369);
621
621
  const getHtmlRspackPluginHooks =
622
- __nccwpck_require__(695).getHtmlRspackPluginHooks;
622
+ __nccwpck_require__(575).getHtmlRspackPluginHooks;
623
623
  class HtmlRspackPlugin {
624
624
  constructor(userOptions = {}) {
625
625
  this.version = HtmlRspackPlugin.version;
@@ -1075,6 +1075,7 @@
1075
1075
  const htmlRegExp = /(<html[^>]*>)/i;
1076
1076
  const headRegExp = /(<\/head\s*>)/i;
1077
1077
  const bodyRegExp = /(<\/body\s*>)/i;
1078
+ const doctypeRegExp = /<!doctype html>/i;
1078
1079
  const metaViewportRegExp = /<meta[^>]+name=["']viewport["'][^>]*>/i;
1079
1080
  const body = assetTags.bodyTags.map((assetTagObject) =>
1080
1081
  htmlTagObjectToString(assetTagObject, this.options.xhtml),
@@ -1107,7 +1108,14 @@
1107
1108
  if (head.length) {
1108
1109
  if (!headRegExp.test(html)) {
1109
1110
  if (!htmlRegExp.test(html)) {
1110
- html = "<head></head>" + html;
1111
+ if (doctypeRegExp.test(html)) {
1112
+ html = html.replace(
1113
+ doctypeRegExp,
1114
+ (match) => match + "<head></head>",
1115
+ );
1116
+ } else {
1117
+ html = "<head></head>" + html;
1118
+ }
1111
1119
  } else {
1112
1120
  html = html.replace(
1113
1121
  htmlRegExp,
@@ -1578,6 +1586,6 @@
1578
1586
  }
1579
1587
  if (typeof __nccwpck_require__ !== "undefined")
1580
1588
  __nccwpck_require__.ab = __dirname + "/";
1581
- var __webpack_exports__ = __nccwpck_require__(479);
1589
+ var __webpack_exports__ = __nccwpck_require__(535);
1582
1590
  module.exports = __webpack_exports__;
1583
1591
  })();
@@ -1 +1 @@
1
- {"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.0.2","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.0.4","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 762: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(688)["default"];
4
+ 31: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(785)["default"];
6
6
  },
7
- 688: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 785: (__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__(321);
12
+ var _utils = __nccwpck_require__(164);
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
- 321: (module, exports, __nccwpck_require__) => {
182
+ 164: (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__(762);
719
+ var __webpack_exports__ = __nccwpck_require__(31);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 275: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 481: (__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
- 262: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 740: (__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__(275);
133
+ const helpers_1 = __nccwpck_require__(481);
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__(262);
315
+ const hooks_1 = __nccwpck_require__(740);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
@@ -232,7 +232,7 @@ declare namespace WebSocket {
232
232
  * headers. If finishRequest is set, then it has the responsibility to call
233
233
  * request.end() once it is done setting request headers.
234
234
  */
235
- type FinishRequestCallback = (request: IncomingMessage, websocket: WebSocket) => void;
235
+ type FinishRequestCallback = (request: ClientRequest, websocket: WebSocket) => void;
236
236
 
237
237
  interface ClientOptions extends SecureContextOptions {
238
238
  protocol?: string | undefined;
package/dist/index.cjs CHANGED
@@ -2207,7 +2207,7 @@ for(var __webpack_i__ in (()=>{
2207
2207
  async function createContext(options, userConfig) {
2208
2208
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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;
2209
2209
  return {
2210
- version: "1.3.1",
2210
+ version: "1.3.3",
2211
2211
  rootPath,
2212
2212
  distPath: '',
2213
2213
  cachePath,
@@ -2248,36 +2248,28 @@ for(var __webpack_i__ in (()=>{
2248
2248
  setup (api) {
2249
2249
  let htmlTagsMap = new Map(), iconFormatMap = new Map(), formatIcon = (icon, distDir, publicPath)=>{
2250
2250
  let { src, size } = icon, cached = iconFormatMap.get(src);
2251
- if (cached) return {
2252
- ...cached,
2253
- ...icon
2254
- };
2251
+ if (cached) return cached;
2255
2252
  let sizes = `${size}x${size}`;
2256
2253
  if (isURL(src)) {
2257
- let paths = {
2254
+ let formatted = {
2255
+ ...icon,
2256
+ src,
2258
2257
  sizes,
2259
2258
  isURL: !0,
2260
- requestPath: src,
2261
- absolutePath: src,
2262
- relativePath: src,
2263
2259
  mimeType: (0, mrmime_index_js_namespaceObject.lookup)(src)
2264
2260
  };
2265
- return iconFormatMap.set(src, paths), {
2266
- ...paths,
2267
- ...icon
2268
- };
2261
+ return iconFormatMap.set(src, formatted), formatted;
2269
2262
  }
2270
- let absolutePath = external_node_path_default().isAbsolute(src) ? src : external_node_path_default().join(api.context.rootPath, src), relativePath = external_node_path_default().posix.join(distDir, external_node_path_default().basename(absolutePath)), paths = {
2263
+ let absolutePath = external_node_path_default().isAbsolute(src) ? src : external_node_path_default().join(api.context.rootPath, src), relativePath = external_node_path_default().posix.join(distDir, external_node_path_default().basename(absolutePath)), formatted = {
2264
+ ...icon,
2271
2265
  sizes,
2272
- requestPath: ensureAssetPrefix(relativePath, publicPath),
2266
+ src: ensureAssetPrefix(relativePath, publicPath),
2267
+ isURL: !1,
2273
2268
  absolutePath,
2274
2269
  relativePath,
2275
2270
  mimeType: (0, mrmime_index_js_namespaceObject.lookup)(absolutePath)
2276
2271
  };
2277
- return iconFormatMap.set(src, paths), {
2278
- ...paths,
2279
- ...icon
2280
- };
2272
+ return iconFormatMap.set(src, formatted), formatted;
2281
2273
  };
2282
2274
  api.processAssets({
2283
2275
  stage: 'additional'
@@ -2311,14 +2303,14 @@ for(var __webpack_i__ in (()=>{
2311
2303
  attrs: {
2312
2304
  rel: 'apple-touch-icon',
2313
2305
  sizes: icon.sizes,
2314
- href: icon.requestPath
2306
+ href: icon.src
2315
2307
  }
2316
2308
  });
2317
2309
  }
2318
2310
  if (appIcon.name) {
2319
2311
  let manifestIcons = icons.filter((icon)=>'web-app-manifest' === icon.target || !icon.target).map((icon)=>{
2320
2312
  let result = {
2321
- src: icon.requestPath,
2313
+ src: icon.src,
2322
2314
  sizes: icon.sizes
2323
2315
  };
2324
2316
  return icon.mimeType ? {
@@ -2344,9 +2336,11 @@ for(var __webpack_i__ in (()=>{
2344
2336
  headTags,
2345
2337
  bodyTags
2346
2338
  };
2347
- }), api.onCloseDevServer(()=>{
2348
- htmlTagsMap.clear(), iconFormatMap.clear();
2349
2339
  });
2340
+ let clean = ()=>{
2341
+ htmlTagsMap.clear(), iconFormatMap.clear();
2342
+ };
2343
+ api.onCloseDevServer(clean), api.onCloseBuild(clean);
2350
2344
  }
2351
2345
  });
2352
2346
  async function modifyBundlerChain(context, utils) {
@@ -2392,6 +2386,7 @@ for(var __webpack_i__ in (()=>{
2392
2386
  },
2393
2387
  ONE_OF: {
2394
2388
  SVG: 'svg',
2389
+ SVG_RAW: 'svg-asset-raw',
2395
2390
  SVG_URL: 'svg-asset-url',
2396
2391
  SVG_ASSET: 'svg-asset',
2397
2392
  SVG_REACT: 'svg-react',
@@ -3008,7 +3003,8 @@ for(var __webpack_i__ in (()=>{
3008
3003
  var external_node_zlib_default = __webpack_require__.n(external_node_zlib_namespaceObject);
3009
3004
  let fileSize_gzip = (0, external_node_util_namespaceObject.promisify)(external_node_zlib_default().gzip);
3010
3005
  async function gzipSize(input) {
3011
- return (await fileSize_gzip(input)).length;
3006
+ let data = await fileSize_gzip(input);
3007
+ return Buffer.byteLength(data);
3012
3008
  }
3013
3009
  let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), getAssetColor = (size)=>size > 300000 ? index_js_default().red : size > 100000 ? index_js_default().yellow : index_js_default().green, calcFileSize = (len)=>{
3014
3010
  let val = len / 1000;
@@ -3018,7 +3014,7 @@ for(var __webpack_i__ in (()=>{
3018
3014
  let logs = [];
3019
3015
  if (!1 === options.detail && !1 === options.total) return logs;
3020
3016
  let formatAsset = async (asset, distPath, distFolder)=>{
3021
- let fileName = asset.name.split('?')[0], contents = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, fileName)), size = contents.length, gzippedSize = options.compressed && isCompressible(fileName) ? await gzipSize(contents) : null, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
3017
+ let fileName = asset.name.split('?')[0], contents = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, fileName)), size = Buffer.byteLength(contents), gzippedSize = options.compressed && isCompressible(fileName) ? await gzipSize(contents) : null, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
3022
3018
  return {
3023
3019
  size,
3024
3020
  folder: external_node_path_default().join(distFolder, external_node_path_default().dirname(fileName)),
@@ -3894,18 +3890,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3894
3890
  'Brave Browser',
3895
3891
  'Vivaldi',
3896
3892
  'Chromium'
3897
- ], getTargetBrowser = async ()=>{
3898
- let targetBrowser = process.env.BROWSER;
3899
- if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
3900
- let { stdout: ps } = await execAsync('ps cax');
3901
- targetBrowser = supportedChromiumBrowsers.find((b)=>ps.includes(b));
3902
- }
3903
- return targetBrowser;
3904
- };
3893
+ ], getDefaultBrowserForAppleScript = async ()=>{
3894
+ let { stdout: ps } = await execAsync('ps cax');
3895
+ return supportedChromiumBrowsers.find((b)=>ps.includes(b));
3896
+ }, mapChromiumBrowserName = (browser)=>'chrome' === browser || 'google chrome' === browser ? 'Google Chrome' : browser, shouldTryAppleScript = (browser)=>'darwin' === process.platform && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)));
3905
3897
  async function openBrowser(url) {
3906
- if ('darwin' === process.platform) try {
3907
- let targetBrowser = await getTargetBrowser();
3908
- if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${targetBrowser}"`, {
3898
+ let browser = process.env.BROWSER;
3899
+ if (shouldTryAppleScript(browser)) try {
3900
+ let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
3901
+ if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
3909
3902
  cwd: STATIC_PATH
3910
3903
  }), !0;
3911
3904
  rslog_index_js_namespaceObject.logger.debug('failed to find the target browser.');
@@ -3914,7 +3907,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3914
3907
  }
3915
3908
  try {
3916
3909
  let { default: open } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/open/index.js"));
3917
- return await open(url), !0;
3910
+ return await open(url, browser ? {
3911
+ app: {
3912
+ name: browser
3913
+ }
3914
+ } : {}), !0;
3918
3915
  } catch (err) {
3919
3916
  return rslog_index_js_namespaceObject.logger.error('Failed to open start URL.'), rslog_index_js_namespaceObject.logger.error(err), !1;
3920
3917
  }
@@ -4957,7 +4954,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4957
4954
  cwd: root,
4958
4955
  rsbuildConfig: ()=>init_loadConfig(root),
4959
4956
  environment: commonOpts.environment,
4960
- loadEnv: {
4957
+ loadEnv: !1 !== commonOpts.env && {
4961
4958
  cwd: getEnvDir(root, commonOpts.envDir),
4962
4959
  mode: commonOpts.envMode
4963
4960
  }
@@ -5902,17 +5899,16 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5902
5899
  };
5903
5900
  }, external_node_vm_namespaceObject = require("node:vm");
5904
5901
  var external_node_vm_default = __webpack_require__.n(external_node_vm_namespaceObject);
5905
- let SYNTHETIC_MODULES_STORE = '__SYNTHETIC_MODULES_STORE', asModule = async (something, context, unlinked)=>{
5902
+ let asModule = async (something, context, unlinked)=>{
5906
5903
  if (something instanceof external_node_vm_default().Module) return something;
5907
- context[SYNTHETIC_MODULES_STORE] = context[SYNTHETIC_MODULES_STORE] || [];
5908
- let i = context[SYNTHETIC_MODULES_STORE].length;
5909
- context[SYNTHETIC_MODULES_STORE].push(something);
5910
- let code = [
5904
+ let exports1 = [
5911
5905
  ...new Set([
5912
5906
  'default',
5913
5907
  ...Object.keys(something)
5914
5908
  ])
5915
- ].map((name)=>`const _${name} = ${SYNTHETIC_MODULES_STORE}[${i}]${'default' === name ? '' : `[${JSON.stringify(name)}]`}; export { _${name} as ${name}};`).join('\n'), m = new (external_node_vm_default()).SourceTextModule(code, {
5909
+ ], m = new (external_node_vm_default()).SyntheticModule(exports1, ()=>{
5910
+ for (let name of exports1)m.setExport(name, 'default' === name ? something : something[name]);
5911
+ }, {
5916
5912
  context
5917
5913
  });
5918
5914
  return unlinked || (await m.link(()=>{}), m.instantiate && m.instantiate(), await m.evaluate()), m;
@@ -6062,9 +6058,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6062
6058
  });
6063
6059
  }
6064
6060
  createEsmRequirer() {
6065
- let esmContext = external_node_vm_default().createContext(this.baseModuleScope, {
6066
- name: 'context for esm'
6067
- }), esmCache = new Map(), esmIdentifier = this._options.name;
6061
+ let esmCache = new Map(), esmIdentifier = this._options.name;
6068
6062
  return (currentDirectory, modulePath, context = {})=>{
6069
6063
  if (!external_node_vm_default().SourceTextModule) throw Error('[rsbuild:runner] Running ESM bundle needs add Node.js option "--experimental-vm-modules".');
6070
6064
  let _require = this.getRequire(), file = context.file || this.getFile(modulePath, currentDirectory);
@@ -6073,7 +6067,6 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6073
6067
  return (esm || (esm = new (external_node_vm_default()).SourceTextModule(file.content, {
6074
6068
  identifier: `${esmIdentifier}-${file.path}`,
6075
6069
  url: `${(0, external_node_url_namespaceObject.pathToFileURL)(file.path).href}?${esmIdentifier}`,
6076
- context: esmContext,
6077
6070
  initializeImportMeta: (meta, _)=>{
6078
6071
  meta.url = (0, external_node_url_namespaceObject.pathToFileURL)(file.path).href;
6079
6072
  },
@@ -7394,7 +7387,7 @@ ${section.body}` : section.body).join("\n\n"));
7394
7387
  String
7395
7388
  ],
7396
7389
  default: []
7397
- }).option('--env-dir <dir>', 'specify the directory to load `.env` files');
7390
+ }).option('--env-dir <dir>', 'specify the directory to load `.env` files').option('--no-env', 'Disable loading `.env` files');
7398
7391
  }, applyServerOptions = (command)=>{
7399
7392
  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');
7400
7393
  };
@@ -7408,11 +7401,11 @@ ${section.body}` : section.body).join("\n\n"));
7408
7401
  }
7409
7402
  process.title = 'rsbuild-node';
7410
7403
  let { npm_execpath } = process.env;
7411
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.1\n`);
7404
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.3\n`);
7412
7405
  try {
7413
7406
  !function() {
7414
7407
  let cli = cac_dist('rsbuild');
7415
- cli.help(), cli.version("1.3.1"), applyCommonOptions(cli);
7408
+ cli.help(), cli.version("1.3.3"), applyCommonOptions(cli);
7416
7409
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7417
7410
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7418
7411
  try {
@@ -7463,7 +7456,7 @@ ${section.body}` : section.body).join("\n\n"));
7463
7456
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7464
7457
  }
7465
7458
  }
7466
- let src_rslib_entry_version = "1.3.1";
7459
+ let src_rslib_entry_version = "1.3.3";
7467
7460
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, 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 === [
7468
7461
  "PLUGIN_CSS_NAME",
7469
7462
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -2107,7 +2107,7 @@ async function updateEnvironmentContext(context, configs) {
2107
2107
  async function createContext(options, userConfig) {
2108
2108
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
2109
2109
  return {
2110
- version: "1.3.1",
2110
+ version: "1.3.3",
2111
2111
  rootPath,
2112
2112
  distPath: '',
2113
2113
  cachePath,
@@ -2148,36 +2148,28 @@ let pluginAppIcon = ()=>({
2148
2148
  setup (api) {
2149
2149
  let htmlTagsMap = new Map(), iconFormatMap = new Map(), formatIcon = (icon, distDir, publicPath)=>{
2150
2150
  let { src, size } = icon, cached = iconFormatMap.get(src);
2151
- if (cached) return {
2152
- ...cached,
2153
- ...icon
2154
- };
2151
+ if (cached) return cached;
2155
2152
  let sizes = `${size}x${size}`;
2156
2153
  if (isURL(src)) {
2157
- let paths = {
2154
+ let formatted = {
2155
+ ...icon,
2156
+ src,
2158
2157
  sizes,
2159
2158
  isURL: !0,
2160
- requestPath: src,
2161
- absolutePath: src,
2162
- relativePath: src,
2163
2159
  mimeType: (0, __WEBPACK_EXTERNAL_MODULE__compiled_mrmime_index_js_86f064ca__.lookup)(src)
2164
2160
  };
2165
- return iconFormatMap.set(src, paths), {
2166
- ...paths,
2167
- ...icon
2168
- };
2161
+ return iconFormatMap.set(src, formatted), formatted;
2169
2162
  }
2170
- let absolutePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(src) ? src : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.rootPath, src), relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.posix.join(distDir, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(absolutePath)), paths = {
2163
+ let absolutePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(src) ? src : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.rootPath, src), relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.posix.join(distDir, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(absolutePath)), formatted = {
2164
+ ...icon,
2171
2165
  sizes,
2172
- requestPath: ensureAssetPrefix(relativePath, publicPath),
2166
+ src: ensureAssetPrefix(relativePath, publicPath),
2167
+ isURL: !1,
2173
2168
  absolutePath,
2174
2169
  relativePath,
2175
2170
  mimeType: (0, __WEBPACK_EXTERNAL_MODULE__compiled_mrmime_index_js_86f064ca__.lookup)(absolutePath)
2176
2171
  };
2177
- return iconFormatMap.set(src, paths), {
2178
- ...paths,
2179
- ...icon
2180
- };
2172
+ return iconFormatMap.set(src, formatted), formatted;
2181
2173
  };
2182
2174
  api.processAssets({
2183
2175
  stage: 'additional'
@@ -2211,14 +2203,14 @@ let pluginAppIcon = ()=>({
2211
2203
  attrs: {
2212
2204
  rel: 'apple-touch-icon',
2213
2205
  sizes: icon.sizes,
2214
- href: icon.requestPath
2206
+ href: icon.src
2215
2207
  }
2216
2208
  });
2217
2209
  }
2218
2210
  if (appIcon.name) {
2219
2211
  let manifestIcons = icons.filter((icon)=>'web-app-manifest' === icon.target || !icon.target).map((icon)=>{
2220
2212
  let result = {
2221
- src: icon.requestPath,
2213
+ src: icon.src,
2222
2214
  sizes: icon.sizes
2223
2215
  };
2224
2216
  return icon.mimeType ? {
@@ -2244,9 +2236,11 @@ let pluginAppIcon = ()=>({
2244
2236
  headTags,
2245
2237
  bodyTags
2246
2238
  };
2247
- }), api.onCloseDevServer(()=>{
2248
- htmlTagsMap.clear(), iconFormatMap.clear();
2249
2239
  });
2240
+ let clean = ()=>{
2241
+ htmlTagsMap.clear(), iconFormatMap.clear();
2242
+ };
2243
+ api.onCloseDevServer(clean), api.onCloseBuild(clean);
2250
2244
  }
2251
2245
  });
2252
2246
  async function modifyBundlerChain(context, utils) {
@@ -2292,6 +2286,7 @@ let configChain_CHAIN_ID = {
2292
2286
  },
2293
2287
  ONE_OF: {
2294
2288
  SVG: 'svg',
2289
+ SVG_RAW: 'svg-asset-raw',
2295
2290
  SVG_URL: 'svg-asset-url',
2296
2291
  SVG_ASSET: 'svg-asset',
2297
2292
  SVG_REACT: 'svg-react',
@@ -2905,7 +2900,8 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
2905
2900
  }
2906
2901
  }), fileSize_gzip = (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.promisify)(__WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__.default.gzip);
2907
2902
  async function gzipSize(input) {
2908
- return (await fileSize_gzip(input)).length;
2903
+ let data = await fileSize_gzip(input);
2904
+ return Buffer.byteLength(data);
2909
2905
  }
2910
2906
  let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), getAssetColor = (size)=>size > 300000 ? __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.red : size > 100000 ? __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow : __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.green, calcFileSize = (len)=>{
2911
2907
  let val = len / 1000;
@@ -2915,7 +2911,7 @@ async function printFileSizes(options, stats, rootPath, environmentName) {
2915
2911
  let logs = [];
2916
2912
  if (!1 === options.detail && !1 === options.total) return logs;
2917
2913
  let formatAsset = async (asset, distPath, distFolder)=>{
2918
- let fileName = asset.name.split('?')[0], contents = await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.readFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(distPath, fileName)), size = contents.length, gzippedSize = options.compressed && isCompressible(fileName) ? await gzipSize(contents) : null, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
2914
+ let fileName = asset.name.split('?')[0], contents = await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.readFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(distPath, fileName)), size = Buffer.byteLength(contents), gzippedSize = options.compressed && isCompressible(fileName) ? await gzipSize(contents) : null, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
2919
2915
  return {
2920
2916
  size,
2921
2917
  folder: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(distFolder, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.dirname(fileName)),
@@ -3785,18 +3781,15 @@ let execAsync = (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.promisify)(__
3785
3781
  'Brave Browser',
3786
3782
  'Vivaldi',
3787
3783
  'Chromium'
3788
- ], getTargetBrowser = async ()=>{
3789
- let targetBrowser = process.env.BROWSER;
3790
- if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
3791
- let { stdout: ps } = await execAsync('ps cax');
3792
- targetBrowser = supportedChromiumBrowsers.find((b)=>ps.includes(b));
3793
- }
3794
- return targetBrowser;
3795
- };
3784
+ ], getDefaultBrowserForAppleScript = async ()=>{
3785
+ let { stdout: ps } = await execAsync('ps cax');
3786
+ return supportedChromiumBrowsers.find((b)=>ps.includes(b));
3787
+ }, mapChromiumBrowserName = (browser)=>'chrome' === browser || 'google chrome' === browser ? 'Google Chrome' : browser, shouldTryAppleScript = (browser)=>'darwin' === process.platform && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)));
3796
3788
  async function openBrowser(url) {
3797
- if ('darwin' === process.platform) try {
3798
- let targetBrowser = await getTargetBrowser();
3799
- if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${targetBrowser}"`, {
3789
+ let browser = process.env.BROWSER;
3790
+ if (shouldTryAppleScript(browser)) try {
3791
+ let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
3792
+ if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
3800
3793
  cwd: STATIC_PATH
3801
3794
  }), !0;
3802
3795
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('failed to find the target browser.');
@@ -3805,7 +3798,11 @@ async function openBrowser(url) {
3805
3798
  }
3806
3799
  try {
3807
3800
  let { default: open } = await import("../compiled/open/index.js");
3808
- return await open(url), !0;
3801
+ return await open(url, browser ? {
3802
+ app: {
3803
+ name: browser
3804
+ }
3805
+ } : {}), !0;
3809
3806
  } catch (err) {
3810
3807
  return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to open start URL.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err), !1;
3811
3808
  }
@@ -4842,7 +4839,7 @@ async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
4842
4839
  cwd: root,
4843
4840
  rsbuildConfig: ()=>init_loadConfig(root),
4844
4841
  environment: commonOpts.environment,
4845
- loadEnv: {
4842
+ loadEnv: !1 !== commonOpts.env && {
4846
4843
  cwd: getEnvDir(root, commonOpts.envDir),
4847
4844
  mode: commonOpts.envMode
4848
4845
  }
@@ -5781,17 +5778,16 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
5781
5778
  onUpgrade,
5782
5779
  middlewares
5783
5780
  };
5784
- }, SYNTHETIC_MODULES_STORE = '__SYNTHETIC_MODULES_STORE', asModule = async (something, context, unlinked)=>{
5781
+ }, asModule = async (something, context, unlinked)=>{
5785
5782
  if (something instanceof __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.Module) return something;
5786
- context[SYNTHETIC_MODULES_STORE] = context[SYNTHETIC_MODULES_STORE] || [];
5787
- let i = context[SYNTHETIC_MODULES_STORE].length;
5788
- context[SYNTHETIC_MODULES_STORE].push(something);
5789
- let code = [
5783
+ let exports = [
5790
5784
  ...new Set([
5791
5785
  'default',
5792
5786
  ...Object.keys(something)
5793
5787
  ])
5794
- ].map((name)=>`const _${name} = ${SYNTHETIC_MODULES_STORE}[${i}]${'default' === name ? '' : `[${JSON.stringify(name)}]`}; export { _${name} as ${name}};`).join('\n'), m = new __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.SourceTextModule(code, {
5788
+ ], m = new __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.SyntheticModule(exports, ()=>{
5789
+ for (let name of exports)m.setExport(name, 'default' === name ? something : something[name]);
5790
+ }, {
5795
5791
  context
5796
5792
  });
5797
5793
  return unlinked || (await m.link(()=>{}), m.instantiate && m.instantiate(), await m.evaluate()), m;
@@ -5939,9 +5935,7 @@ class EsmRunner extends CommonJsRunner {
5939
5935
  });
5940
5936
  }
5941
5937
  createEsmRequirer() {
5942
- let esmContext = __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.createContext(this.baseModuleScope, {
5943
- name: 'context for esm'
5944
- }), esmCache = new Map(), esmIdentifier = this._options.name;
5938
+ let esmCache = new Map(), esmIdentifier = this._options.name;
5945
5939
  return (currentDirectory, modulePath, context = {})=>{
5946
5940
  if (!__WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.SourceTextModule) throw Error('[rsbuild:runner] Running ESM bundle needs add Node.js option "--experimental-vm-modules".');
5947
5941
  let _require = this.getRequire(), file = context.file || this.getFile(modulePath, currentDirectory);
@@ -5950,7 +5944,6 @@ class EsmRunner extends CommonJsRunner {
5950
5944
  return (esm || (esm = new __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__.default.SourceTextModule(file.content, {
5951
5945
  identifier: `${esmIdentifier}-${file.path}`,
5952
5946
  url: `${(0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(file.path).href}?${esmIdentifier}`,
5953
- context: esmContext,
5954
5947
  initializeImportMeta: (meta, _)=>{
5955
5948
  meta.url = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(file.path).href;
5956
5949
  },
@@ -7268,7 +7261,7 @@ let cac_dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
7268
7261
  String
7269
7262
  ],
7270
7263
  default: []
7271
- }).option('--env-dir <dir>', 'specify the directory to load `.env` files');
7264
+ }).option('--env-dir <dir>', 'specify the directory to load `.env` files').option('--no-env', 'Disable loading `.env` files');
7272
7265
  }, applyServerOptions = (command)=>{
7273
7266
  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');
7274
7267
  };
@@ -7282,11 +7275,11 @@ async function runCLI() {
7282
7275
  }
7283
7276
  process.title = 'rsbuild-node';
7284
7277
  let { npm_execpath } = process.env;
7285
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.1\n`);
7278
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.3\n`);
7286
7279
  try {
7287
7280
  !function() {
7288
7281
  let cli = cac_dist('rsbuild');
7289
- cli.help(), cli.version("1.3.1"), applyCommonOptions(cli);
7282
+ cli.help(), cli.version("1.3.3"), applyCommonOptions(cli);
7290
7283
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7291
7284
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7292
7285
  try {
@@ -7337,6 +7330,6 @@ async function runCLI() {
7337
7330
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
7338
7331
  }
7339
7332
  }
7340
- let src_version = "1.3.1";
7333
+ let src_version = "1.3.3";
7341
7334
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
7342
7335
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -6,6 +6,7 @@ export type CommonOptions = {
6
6
  mode?: RsbuildMode;
7
7
  config?: string;
8
8
  configLoader?: ConfigLoader;
9
+ env?: boolean;
9
10
  envDir?: string;
10
11
  envMode?: string;
11
12
  open?: boolean | string;
@@ -58,6 +58,7 @@ export declare const CHAIN_ID: {
58
58
  /** Predefined rule groups */
59
59
  readonly ONE_OF: {
60
60
  readonly SVG: "svg";
61
+ readonly SVG_RAW: "svg-asset-raw";
61
62
  readonly SVG_URL: "svg-asset-url";
62
63
  readonly SVG_ASSET: "svg-asset";
63
64
  readonly SVG_REACT: "svg-react";
@@ -1,4 +1,3 @@
1
- import type { Compiler as WebpackCompiler, MultiCompiler as WebpackMultiCompiler } from 'webpack';
2
1
  import color from '../../compiled/picocolors/index.js';
3
2
  import type RspackChain from '../../compiled/rspack-chain/index.js';
4
3
  import type { FilenameConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildTarget, Rspack } from '../types';
@@ -34,7 +33,7 @@ export declare const upperFirst: (str: string) => string;
34
33
  export declare const isURL: (str: string) => boolean;
35
34
  export declare const createVirtualModule: (content: string) => string;
36
35
  export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
37
- export declare const isMultiCompiler: <C extends Rspack.Compiler | WebpackCompiler = Rspack.Compiler, M extends Rspack.MultiCompiler | WebpackMultiCompiler = Rspack.MultiCompiler>(compiler: C | M) => compiler is M;
36
+ export declare const isMultiCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler) => compiler is Rspack.MultiCompiler;
38
37
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Pick<T, U>;
39
38
  export declare const camelCase: (input: string) => string;
40
39
  export declare const prettyTime: (seconds: number) => string;
@@ -127,15 +127,8 @@ export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, '
127
127
  };
128
128
  export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
129
129
  export type StartDevServer = (options?: StartDevServerOptions) => Promise<StartServerResult>;
130
- export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = {
130
+ export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = Pick<RsbuildInstance, 'build' | 'createCompiler' | 'createDevServer' | 'startDevServer'> & {
131
131
  readonly bundler: Bundler;
132
- createCompiler: CreateCompiler;
133
- /**
134
- * It is designed for higher-level frameworks that require a custom server
135
- */
136
- createDevServer: CreateDevServer;
137
- startDevServer: StartDevServer;
138
- build: Build;
139
132
  initConfigs: () => Promise<B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[]>;
140
133
  inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult<B>>;
141
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,20 +46,20 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.3.0",
49
+ "@rspack/core": "1.3.2",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.15",
52
52
  "core-js": "~3.41.0",
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@rslib/core": "0.6.0",
56
+ "@rslib/core": "0.6.1",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.17",
59
- "@types/node": "^22.13.14",
59
+ "@types/node": "^22.14.0",
60
60
  "@types/on-finished": "2.3.4",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
- "@types/ws": "^8.18.0",
62
+ "@types/ws": "^8.18.1",
63
63
  "browserslist-load-config": "1.0.0",
64
64
  "cac": "^6.7.14",
65
65
  "chokidar": "^4.0.3",
@@ -70,7 +70,7 @@
70
70
  "deepmerge": "^4.3.1",
71
71
  "dotenv": "16.4.7",
72
72
  "dotenv-expand": "12.0.1",
73
- "html-rspack-plugin": "6.0.2",
73
+ "html-rspack-plugin": "6.0.4",
74
74
  "http-proxy-middleware": "^2.0.6",
75
75
  "launch-editor-middleware": "^2.10.0",
76
76
  "mrmime": "^2.0.1",