@rsbuild/core 1.0.1-beta.2 → 1.0.1-beta.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,22 +1,22 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 4835: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 7286: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(613);
5
+ const loader = __nccwpck_require__(5866);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(8333).defaultGetLocalIdent;
8
+ __nccwpck_require__(7040).defaultGetLocalIdent;
9
9
  },
10
- 613: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 5866: (__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__(977));
15
15
  var _package = _interopRequireDefault(__nccwpck_require__(7972));
16
16
  var _semver = __nccwpck_require__(938);
17
- var _options = _interopRequireDefault(__nccwpck_require__(5243));
18
- var _plugins = __nccwpck_require__(5984);
19
- var _utils = __nccwpck_require__(8333);
17
+ var _options = _interopRequireDefault(__nccwpck_require__(1991));
18
+ var _plugins = __nccwpck_require__(2754);
19
+ var _utils = __nccwpck_require__(7040);
20
20
  function _interopRequireDefault(obj) {
21
21
  return obj && obj.__esModule ? obj : { default: obj };
22
22
  }
@@ -243,7 +243,7 @@
243
243
  callback(null, `${importCode}${moduleCode}${exportCode}`);
244
244
  }
245
245
  },
246
- 5984: (__unused_webpack_module, exports, __nccwpck_require__) => {
246
+ 2754: (__unused_webpack_module, exports, __nccwpck_require__) => {
247
247
  "use strict";
248
248
  Object.defineProperty(exports, "__esModule", { value: true });
249
249
  Object.defineProperty(exports, "icssParser", {
@@ -265,22 +265,22 @@
265
265
  },
266
266
  });
267
267
  var _postcssImportParser = _interopRequireDefault(
268
- __nccwpck_require__(3818),
268
+ __nccwpck_require__(4460),
269
269
  );
270
270
  var _postcssIcssParser = _interopRequireDefault(
271
- __nccwpck_require__(8822),
271
+ __nccwpck_require__(8815),
272
272
  );
273
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(8064));
273
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(2374));
274
274
  function _interopRequireDefault(obj) {
275
275
  return obj && obj.__esModule ? obj : { default: obj };
276
276
  }
277
277
  },
278
- 8822: (__unused_webpack_module, exports, __nccwpck_require__) => {
278
+ 8815: (__unused_webpack_module, exports, __nccwpck_require__) => {
279
279
  "use strict";
280
280
  Object.defineProperty(exports, "__esModule", { value: true });
281
281
  exports["default"] = void 0;
282
282
  var _icssUtils = __nccwpck_require__(2304);
283
- var _utils = __nccwpck_require__(8333);
283
+ var _utils = __nccwpck_require__(7040);
284
284
  const plugin = (options = {}) => ({
285
285
  postcssPlugin: "postcss-icss-parser",
286
286
  async OnceExit(root) {
@@ -379,14 +379,14 @@
379
379
  plugin.postcss = true;
380
380
  var _default = (exports["default"] = plugin);
381
381
  },
382
- 3818: (__unused_webpack_module, exports, __nccwpck_require__) => {
382
+ 4460: (__unused_webpack_module, exports, __nccwpck_require__) => {
383
383
  "use strict";
384
384
  Object.defineProperty(exports, "__esModule", { value: true });
385
385
  exports["default"] = void 0;
386
386
  var _postcssValueParser = _interopRequireDefault(
387
387
  __nccwpck_require__(1036),
388
388
  );
389
- var _utils = __nccwpck_require__(8333);
389
+ var _utils = __nccwpck_require__(7040);
390
390
  function _interopRequireDefault(obj) {
391
391
  return obj && obj.__esModule ? obj : { default: obj };
392
392
  }
@@ -691,14 +691,14 @@
691
691
  plugin.postcss = true;
692
692
  var _default = (exports["default"] = plugin);
693
693
  },
694
- 8064: (__unused_webpack_module, exports, __nccwpck_require__) => {
694
+ 2374: (__unused_webpack_module, exports, __nccwpck_require__) => {
695
695
  "use strict";
696
696
  Object.defineProperty(exports, "__esModule", { value: true });
697
697
  exports["default"] = void 0;
698
698
  var _postcssValueParser = _interopRequireDefault(
699
699
  __nccwpck_require__(1036),
700
700
  );
701
- var _utils = __nccwpck_require__(8333);
701
+ var _utils = __nccwpck_require__(7040);
702
702
  function _interopRequireDefault(obj) {
703
703
  return obj && obj.__esModule ? obj : { default: obj };
704
704
  }
@@ -1041,7 +1041,7 @@
1041
1041
  plugin.postcss = true;
1042
1042
  var _default = (exports["default"] = plugin);
1043
1043
  },
1044
- 8333: (__unused_webpack_module, exports, __nccwpck_require__) => {
1044
+ 7040: (__unused_webpack_module, exports, __nccwpck_require__) => {
1045
1045
  "use strict";
1046
1046
  Object.defineProperty(exports, "__esModule", { value: true });
1047
1047
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -7501,7 +7501,7 @@
7501
7501
  "use strict";
7502
7502
  module.exports = require("util");
7503
7503
  },
7504
- 5243: (module) => {
7504
+ 1991: (module) => {
7505
7505
  "use strict";
7506
7506
  module.exports = JSON.parse(
7507
7507
  '{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack-contrib/css-loader#url","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"import":{"description":"Allows to enables/disables `@import` at-rules handling.","link":"https://github.com/webpack-contrib/css-loader#import","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"modules":{"description":"Allows to enable/disable CSS Modules or ICSS and setup configuration.","link":"https://github.com/webpack-contrib/css-loader#modules","anyOf":[{"type":"boolean"},{"enum":["local","global","pure","icss"]},{"type":"object","additionalProperties":false,"properties":{"auto":{"description":"Allows auto enable CSS modules based on filename.","link":"https://github.com/webpack-contrib/css-loader#auto","anyOf":[{"instanceof":"RegExp"},{"instanceof":"Function"},{"type":"boolean"}]},"mode":{"description":"Setup `mode` option.","link":"https://github.com/webpack-contrib/css-loader#mode","anyOf":[{"enum":["local","global","pure","icss"]},{"instanceof":"Function"}]},"localIdentName":{"description":"Allows to configure the generated local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentname","type":"string","minLength":1},"localIdentContext":{"description":"Allows to redefine basic loader context for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentcontext","type":"string","minLength":1},"localIdentHashSalt":{"description":"Allows to add custom hash to generate more unique classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashsalt","type":"string","minLength":1},"localIdentHashFunction":{"description":"Allows to specify hash function to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashfunction","type":"string","minLength":1},"localIdentHashDigest":{"description":"Allows to specify hash digest to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigest","type":"string","minLength":1},"localIdentHashDigestLength":{"description":"Allows to specify hash digest length to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigestlength","type":"number"},"hashStrategy":{"description":"Allows to specify should localName be used when computing the hash.","link":"https://github.com/webpack-contrib/css-loader#hashstrategy","enum":["resource-path-and-local-name","minimal-subset"]},"localIdentRegExp":{"description":"Allows to specify custom RegExp for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentregexp","anyOf":[{"type":"string","minLength":1},{"instanceof":"RegExp"}]},"getLocalIdent":{"description":"Allows to specify a function to generate the classname.","link":"https://github.com/webpack-contrib/css-loader#getlocalident","instanceof":"Function"},"namedExport":{"description":"Enables/disables ES modules named export for locals.","link":"https://github.com/webpack-contrib/css-loader#namedexport","type":"boolean"},"exportGlobals":{"description":"Allows to export names from global class or id, so you can use that as local name.","link":"https://github.com/webpack-contrib/css-loader#exportglobals","type":"boolean"},"exportLocalsConvention":{"description":"Style of exported classnames.","link":"https://github.com/webpack-contrib/css-loader#localsconvention","anyOf":[{"enum":["asIs","as-is","camelCase","camel-case","camelCaseOnly","camel-case-only","dashes","dashesOnly","dashes-only"]},{"instanceof":"Function"}]},"exportOnlyLocals":{"description":"Export only locals.","link":"https://github.com/webpack-contrib/css-loader#exportonlylocals","type":"boolean"},"getJSON":{"description":"Allows outputting of CSS modules mapping through a callback.","link":"https://github.com/webpack-contrib/css-loader#getJSON","instanceof":"Function"}}}]},"sourceMap":{"description":"Allows to enable/disable source maps.","link":"https://github.com/webpack-contrib/css-loader#sourcemap","type":"boolean"},"importLoaders":{"description":"Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.","link":"https://github.com/webpack-contrib/css-loader#importloaders","anyOf":[{"type":"boolean"},{"type":"string"},{"type":"integer"}]},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"exportType":{"description":"Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).","link":"https://github.com/webpack-contrib/css-loader#exporttype","enum":["array","string","css-style-sheet"]}},"type":"object"}',
@@ -7536,6 +7536,6 @@
7536
7536
  }
7537
7537
  if (typeof __nccwpck_require__ !== "undefined")
7538
7538
  __nccwpck_require__.ab = __dirname + "/";
7539
- var __webpack_exports__ = __nccwpck_require__(4835);
7539
+ var __webpack_exports__ = __nccwpck_require__(7286);
7540
7540
  module.exports = __webpack_exports__;
7541
7541
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 70: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 737: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(560);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(937);
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
- 560: (module) => {
307
+ 937: (module) => {
308
308
  "use strict";
309
309
  class HtmlWebpackChildCompiler {
310
310
  constructor(templates) {
@@ -465,7 +465,7 @@
465
465
  }
466
466
  module.exports = { HtmlWebpackChildCompiler };
467
467
  },
468
- 570: (module) => {
468
+ 798: (module) => {
469
469
  "use strict";
470
470
  module.exports = {};
471
471
  module.exports.none = (chunks) => chunks;
@@ -484,7 +484,7 @@
484
484
  };
485
485
  module.exports.auto = module.exports.none;
486
486
  },
487
- 35: (module) => {
487
+ 255: (module) => {
488
488
  "use strict";
489
489
  module.exports = function (err) {
490
490
  return {
@@ -505,7 +505,7 @@
505
505
  };
506
506
  };
507
507
  },
508
- 191: (module, __unused_webpack_exports, __nccwpck_require__) => {
508
+ 0: (module, __unused_webpack_exports, __nccwpck_require__) => {
509
509
  "use strict";
510
510
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(348);
511
511
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -531,7 +531,7 @@
531
531
  }
532
532
  module.exports = { getHtmlRspackPluginHooks };
533
533
  },
534
- 884: (module) => {
534
+ 93: (module) => {
535
535
  const voidTags = [
536
536
  "area",
537
537
  "base",
@@ -599,19 +599,19 @@
599
599
  htmlTagObjectToString,
600
600
  };
601
601
  },
602
- 585: (module, __unused_webpack_exports, __nccwpck_require__) => {
602
+ 592: (module, __unused_webpack_exports, __nccwpck_require__) => {
603
603
  "use strict";
604
604
  const promisify = __nccwpck_require__(837).promisify;
605
605
  const vm = __nccwpck_require__(144);
606
606
  const fs = __nccwpck_require__(147);
607
607
  const path = __nccwpck_require__(17);
608
- const { CachedChildCompilation } = __nccwpck_require__(70);
608
+ const { CachedChildCompilation } = __nccwpck_require__(737);
609
609
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
610
- __nccwpck_require__(884);
611
- const prettyError = __nccwpck_require__(35);
612
- const chunkSorter = __nccwpck_require__(570);
610
+ __nccwpck_require__(93);
611
+ const prettyError = __nccwpck_require__(255);
612
+ const chunkSorter = __nccwpck_require__(798);
613
613
  const getHtmlRspackPluginHooks =
614
- __nccwpck_require__(191).getHtmlRspackPluginHooks;
614
+ __nccwpck_require__(0).getHtmlRspackPluginHooks;
615
615
  class HtmlRspackPlugin {
616
616
  constructor(userOptions = {}) {
617
617
  this.version = HtmlRspackPlugin.version;
@@ -1569,6 +1569,6 @@
1569
1569
  }
1570
1570
  if (typeof __nccwpck_require__ !== "undefined")
1571
1571
  __nccwpck_require__.ab = __dirname + "/";
1572
- var __webpack_exports__ = __nccwpck_require__(585);
1572
+ var __webpack_exports__ = __nccwpck_require__(592);
1573
1573
  module.exports = __webpack_exports__;
1574
1574
  })();
@@ -6780,19 +6780,19 @@
6780
6780
  module.exports = createColors();
6781
6781
  module.exports.createColors = createColors;
6782
6782
  },
6783
- 9635: (module, __unused_webpack_exports, __nccwpck_require__) => {
6783
+ 9337: (module, __unused_webpack_exports, __nccwpck_require__) => {
6784
6784
  "use strict";
6785
- module.exports = __nccwpck_require__(3988)["default"];
6785
+ module.exports = __nccwpck_require__(8725)["default"];
6786
6786
  },
6787
- 3988: (__unused_webpack_module, exports, __nccwpck_require__) => {
6787
+ 8725: (__unused_webpack_module, exports, __nccwpck_require__) => {
6788
6788
  "use strict";
6789
6789
  var __webpack_unused_export__;
6790
6790
  __webpack_unused_export__ = { value: true };
6791
6791
  exports["default"] = loader;
6792
6792
  var _path = _interopRequireDefault(__nccwpck_require__(1017));
6793
6793
  var _package = _interopRequireDefault(__nccwpck_require__(7972));
6794
- var _options = _interopRequireDefault(__nccwpck_require__(4050));
6795
- var _utils = __nccwpck_require__(6245);
6794
+ var _options = _interopRequireDefault(__nccwpck_require__(8850));
6795
+ var _utils = __nccwpck_require__(8084);
6796
6796
  function _interopRequireDefault(obj) {
6797
6797
  return obj && obj.__esModule ? obj : { default: obj };
6798
6798
  }
@@ -6970,7 +6970,7 @@
6970
6970
  callback(null, result.css, map, { ast });
6971
6971
  }
6972
6972
  },
6973
- 6245: (module, exports, __nccwpck_require__) => {
6973
+ 8084: (module, exports, __nccwpck_require__) => {
6974
6974
  "use strict";
6975
6975
  module = __nccwpck_require__.nmd(module);
6976
6976
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -8308,7 +8308,7 @@
8308
8308
  };
8309
8309
  }
8310
8310
  },
8311
- 4050: (module) => {
8311
+ 8850: (module) => {
8312
8312
  "use strict";
8313
8313
  module.exports = JSON.parse(
8314
8314
  '{"title":"PostCSS Loader options","type":"object","properties":{"postcssOptions":{"description":"Options to pass through to `Postcss`.","link":"https://github.com/webpack-contrib/postcss-loader#postcssOptions","anyOf":[{"type":"object","additionalProperties":true,"properties":{"config":{"description":"Allows to specify PostCSS config path.","link":"https://github.com/webpack-contrib/postcss-loader#config","anyOf":[{"description":"Allows to specify the path to the configuration file","type":"string"},{"description":"Enables/Disables autoloading config","type":"boolean"}]}}},{"instanceof":"Function"}]},"execute":{"description":"Enables/Disables PostCSS parser support in \'CSS-in-JS\'.","link":"https://github.com/webpack-contrib/postcss-loader#execute","type":"boolean"},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/postcss-loader#sourcemap","type":"boolean"},"implementation":{"description":"The implementation of postcss to use, instead of the locally installed version","link":"https://github.com/webpack-contrib/postcss-loader#implementation","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
@@ -8418,6 +8418,6 @@
8418
8418
  })();
8419
8419
  if (typeof __nccwpck_require__ !== "undefined")
8420
8420
  __nccwpck_require__.ab = __dirname + "/";
8421
- var __webpack_exports__ = __nccwpck_require__(9635);
8421
+ var __webpack_exports__ = __nccwpck_require__(9337);
8422
8422
  module.exports = __webpack_exports__;
8423
8423
  })();
@@ -1,6 +1,6 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 482: (__unused_webpack_module, exports, __nccwpck_require__) => {
3
+ 9161: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
4
  "use strict";
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 9178: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 4431: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  "use strict";
125
125
  Object.defineProperty(exports, "__esModule", { value: true });
126
126
  exports.normalModuleLoaderHook =
@@ -132,7 +132,7 @@
132
132
  const path_1 = __nccwpck_require__(1017);
133
133
  const tapable_1 = __nccwpck_require__(4260);
134
134
  const webpack_sources_1 = __nccwpck_require__(5433);
135
- const helpers_1 = __nccwpck_require__(482);
135
+ const helpers_1 = __nccwpck_require__(9161);
136
136
  const compilerHookMap = new WeakMap();
137
137
  const getCompilerHooks = (compiler) => {
138
138
  let hooks = compilerHookMap.get(compiler);
@@ -5802,7 +5802,7 @@
5802
5802
  exports.getCompilerHooks =
5803
5803
  void 0;
5804
5804
  const path_1 = __nccwpck_require__(1017);
5805
- const hooks_1 = __nccwpck_require__(9178);
5805
+ const hooks_1 = __nccwpck_require__(4431);
5806
5806
  Object.defineProperty(exports, "getCompilerHooks", {
5807
5807
  enumerable: true,
5808
5808
  get: function () {
@@ -11,7 +11,8 @@ function resolveFileName(stats) {
11
11
  }
12
12
  }
13
13
  }
14
- return stats.moduleName ? `File: ${stats.moduleName}
14
+ const file = stats.file || stats.moduleName;
15
+ return file ? `File: ${file}
15
16
  ` : "";
16
17
  }
17
18
  function hintUnknownFiles(message) {
package/dist/index.cjs CHANGED
@@ -154,7 +154,8 @@ function resolveFileName(stats) {
154
154
  }
155
155
  }
156
156
  }
157
- return stats.moduleName ? `File: ${stats.moduleName}
157
+ const file = stats.file || stats.moduleName;
158
+ return file ? `File: ${file}
158
159
  ` : "";
159
160
  }
160
161
  function hintUnknownFiles(message) {
@@ -378,8 +379,8 @@ function formatStats(stats, options = {}) {
378
379
  errors: getAllStatsErrors(statsData),
379
380
  warnings: getAllStatsWarnings(statsData)
380
381
  },
381
- // display verbose messages in prod build or debug mode
382
- isProd() || import_rslog.logger.level === "verbose"
382
+ // display verbose messages in debug mode
383
+ import_rslog.logger.level === "verbose"
383
384
  );
384
385
  if (stats.hasErrors()) {
385
386
  return {
@@ -1525,10 +1526,13 @@ function getPluginAPI({
1525
1526
  const transform = (descriptor, handler) => {
1526
1527
  const id = `rsbuild-transform-${transformId++}`;
1527
1528
  transformer[id] = handler;
1528
- hooks.modifyBundlerChain.tap((chain, { target }) => {
1529
+ hooks.modifyBundlerChain.tap((chain, { target, environment }) => {
1529
1530
  if (descriptor.targets && !descriptor.targets.includes(target)) {
1530
1531
  return;
1531
1532
  }
1533
+ if (descriptor.environments && !descriptor.environments.includes(environment.name)) {
1534
+ return;
1535
+ }
1532
1536
  const rule = chain.module.rule(id);
1533
1537
  if (descriptor.test) {
1534
1538
  rule.test(descriptor.test);
@@ -1598,7 +1602,7 @@ async function createContextByConfig(options, bundlerType) {
1598
1602
  const rootPath = cwd;
1599
1603
  const cachePath = (0, import_node_path8.join)(rootPath, "node_modules", ".cache");
1600
1604
  return {
1601
- version: "1.0.1-beta.2",
1605
+ version: "1.0.1-beta.3",
1602
1606
  rootPath,
1603
1607
  distPath: "",
1604
1608
  cachePath,
@@ -6036,17 +6040,29 @@ function getMetaTags(entryName, config, templateContent) {
6036
6040
  function getTemplateParameters(entryName, config, assetPrefix) {
6037
6041
  return (compilation, assets, assetTags, pluginOptions) => {
6038
6042
  const { mountId, templateParameters } = config.html;
6043
+ const rspackConfig = compilation.options;
6044
+ const htmlPlugin2 = {
6045
+ tags: assetTags,
6046
+ files: assets,
6047
+ options: pluginOptions
6048
+ };
6039
6049
  const defaultOptions2 = {
6040
6050
  mountId,
6041
6051
  entryName,
6042
6052
  assetPrefix,
6043
6053
  compilation,
6044
- webpackConfig: compilation.options,
6045
- htmlWebpackPlugin: {
6046
- tags: assetTags,
6047
- files: assets,
6048
- options: pluginOptions
6049
- }
6054
+ htmlPlugin: htmlPlugin2,
6055
+ rspackConfig,
6056
+ /**
6057
+ * compatible with html-webpack-plugin
6058
+ * @deprecated may be removed in a future major version, use `rspackConfig` instead
6059
+ */
6060
+ webpackConfig: rspackConfig,
6061
+ /**
6062
+ * compatible with html-webpack-plugin
6063
+ * @deprecated may be removed in a future major version, use `htmlPlugin` instead
6064
+ */
6065
+ htmlWebpackPlugin: htmlPlugin2
6050
6066
  };
6051
6067
  return reduceConfigsWithContext({
6052
6068
  initial: defaultOptions2,
@@ -8800,7 +8816,7 @@ var init_init = __esm({
8800
8816
 
8801
8817
  // src/cli/commands.ts
8802
8818
  function runCli() {
8803
- import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.2");
8819
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.3");
8804
8820
  const devCommand = import_commander.program.command("dev");
8805
8821
  const buildCommand = import_commander.program.command("build");
8806
8822
  const previewCommand = import_commander.program.command("preview");
@@ -8914,7 +8930,7 @@ function prepareCli() {
8914
8930
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
8915
8931
  console.log();
8916
8932
  }
8917
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.2"}`}
8933
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.3"}`}
8918
8934
  `);
8919
8935
  }
8920
8936
  var init_prepare = __esm({
@@ -8997,7 +9013,7 @@ init_logger();
8997
9013
  init_mergeConfig();
8998
9014
  init_helpers();
8999
9015
  init_constants();
9000
- var version = "1.0.1-beta.2";
9016
+ var version = "1.0.1-beta.3";
9001
9017
  // Annotate the CommonJS export names for ESM import in node:
9002
9018
  0 && (module.exports = {
9003
9019
  PLUGIN_CSS_NAME,
package/dist/index.js CHANGED
@@ -46,12 +46,12 @@ var __publicField = (obj, key, value) => {
46
46
  return value;
47
47
  };
48
48
 
49
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.55.0_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
49
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.55.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
50
50
  import { fileURLToPath } from "url";
51
51
  import path from "path";
52
52
  var getFilename, getDirname, __dirname, __filename;
53
53
  var init_esm = __esm({
54
- "../../node_modules/.pnpm/@modern-js+module-tools@2.55.0_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
54
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.55.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
55
55
  "use strict";
56
56
  getFilename = () => fileURLToPath(import.meta.url);
57
57
  getDirname = () => path.dirname(getFilename());
@@ -177,7 +177,8 @@ function resolveFileName(stats) {
177
177
  }
178
178
  }
179
179
  }
180
- return stats.moduleName ? `File: ${stats.moduleName}
180
+ const file = stats.file || stats.moduleName;
181
+ return file ? `File: ${file}
181
182
  ` : "";
182
183
  }
183
184
  function hintUnknownFiles(message) {
@@ -407,8 +408,8 @@ function formatStats(stats, options = {}) {
407
408
  errors: getAllStatsErrors(statsData),
408
409
  warnings: getAllStatsWarnings(statsData)
409
410
  },
410
- // display verbose messages in prod build or debug mode
411
- isProd() || logger.level === "verbose"
411
+ // display verbose messages in debug mode
412
+ logger.level === "verbose"
412
413
  );
413
414
  if (stats.hasErrors()) {
414
415
  return {
@@ -1558,10 +1559,13 @@ function getPluginAPI({
1558
1559
  const transform = (descriptor, handler) => {
1559
1560
  const id = `rsbuild-transform-${transformId++}`;
1560
1561
  transformer[id] = handler;
1561
- hooks.modifyBundlerChain.tap((chain, { target }) => {
1562
+ hooks.modifyBundlerChain.tap((chain, { target, environment }) => {
1562
1563
  if (descriptor.targets && !descriptor.targets.includes(target)) {
1563
1564
  return;
1564
1565
  }
1566
+ if (descriptor.environments && !descriptor.environments.includes(environment.name)) {
1567
+ return;
1568
+ }
1565
1569
  const rule = chain.module.rule(id);
1566
1570
  if (descriptor.test) {
1567
1571
  rule.test(descriptor.test);
@@ -1632,7 +1636,7 @@ async function createContextByConfig(options, bundlerType) {
1632
1636
  const rootPath = cwd;
1633
1637
  const cachePath = join6(rootPath, "node_modules", ".cache");
1634
1638
  return {
1635
- version: "1.0.1-beta.2",
1639
+ version: "1.0.1-beta.3",
1636
1640
  rootPath,
1637
1641
  distPath: "",
1638
1642
  cachePath,
@@ -6109,17 +6113,29 @@ function getMetaTags(entryName, config, templateContent) {
6109
6113
  function getTemplateParameters(entryName, config, assetPrefix) {
6110
6114
  return (compilation, assets, assetTags, pluginOptions) => {
6111
6115
  const { mountId, templateParameters } = config.html;
6116
+ const rspackConfig = compilation.options;
6117
+ const htmlPlugin2 = {
6118
+ tags: assetTags,
6119
+ files: assets,
6120
+ options: pluginOptions
6121
+ };
6112
6122
  const defaultOptions2 = {
6113
6123
  mountId,
6114
6124
  entryName,
6115
6125
  assetPrefix,
6116
6126
  compilation,
6117
- webpackConfig: compilation.options,
6118
- htmlWebpackPlugin: {
6119
- tags: assetTags,
6120
- files: assets,
6121
- options: pluginOptions
6122
- }
6127
+ htmlPlugin: htmlPlugin2,
6128
+ rspackConfig,
6129
+ /**
6130
+ * compatible with html-webpack-plugin
6131
+ * @deprecated may be removed in a future major version, use `rspackConfig` instead
6132
+ */
6133
+ webpackConfig: rspackConfig,
6134
+ /**
6135
+ * compatible with html-webpack-plugin
6136
+ * @deprecated may be removed in a future major version, use `htmlPlugin` instead
6137
+ */
6138
+ htmlWebpackPlugin: htmlPlugin2
6123
6139
  };
6124
6140
  return reduceConfigsWithContext({
6125
6141
  initial: defaultOptions2,
@@ -8905,7 +8921,7 @@ import { existsSync } from "fs";
8905
8921
  import { program } from "../compiled/commander/index.js";
8906
8922
  import color14 from "../compiled/picocolors/index.js";
8907
8923
  function runCli() {
8908
- program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.2");
8924
+ program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.3");
8909
8925
  const devCommand = program.command("dev");
8910
8926
  const buildCommand = program.command("build");
8911
8927
  const previewCommand = program.command("preview");
@@ -9017,7 +9033,7 @@ function prepareCli() {
9017
9033
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
9018
9034
  console.log();
9019
9035
  }
9020
- logger.greet(` ${`Rsbuild v${"1.0.1-beta.2"}`}
9036
+ logger.greet(` ${`Rsbuild v${"1.0.1-beta.3"}`}
9021
9037
  `);
9022
9038
  }
9023
9039
  var init_prepare = __esm({
@@ -9087,7 +9103,7 @@ init_mergeConfig();
9087
9103
  init_helpers();
9088
9104
  init_constants();
9089
9105
  import { rspack as rspack10 } from "@rspack/core";
9090
- var version = "1.0.1-beta.2";
9106
+ var version = "1.0.1-beta.3";
9091
9107
  export {
9092
9108
  PLUGIN_CSS_NAME,
9093
9109
  PLUGIN_SWC_NAME,
@@ -144,6 +144,11 @@ export type TransformDescriptor = {
144
144
  * @see https://rsbuild.dev/config/output/targets
145
145
  */
146
146
  targets?: RsbuildTarget[];
147
+ /**
148
+ * Match based on the Rsbuild environment names and only apply the transform to certain environments.
149
+ * @see https://rsbuild.dev/config/environments
150
+ */
151
+ environments?: string[];
147
152
  /**
148
153
  * If raw is `true`, the transform handler will receive the Buffer type code instead of the string type.
149
154
  * @see https://rspack.dev/api/loader-api#raw-loader
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.0.1-beta.2",
3
+ "version": "1.0.1-beta.3",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,8 +46,8 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.0.0-alpha.4",
50
- "@rspack/lite-tapable": "1.0.0-alpha.4",
49
+ "@rspack/core": "1.0.0-alpha.5",
50
+ "@rspack/lite-tapable": "1.0.0-alpha.5",
51
51
  "@swc/helpers": "0.5.11",
52
52
  "caniuse-lite": "^1.0.30001642",
53
53
  "core-js": "~3.37.1",