@rsbuild/core 1.0.15 → 1.0.17

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
- 2358: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 6754: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(536);
5
+ const loader = __nccwpck_require__(7386);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(9166).defaultGetLocalIdent;
8
+ __nccwpck_require__(3004).defaultGetLocalIdent;
9
9
  },
10
- 536: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 7386: (__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__(9961));
15
15
  var _package = _interopRequireDefault(__nccwpck_require__(3360));
16
16
  var _semver = { satisfies: () => true };
17
- var _options = _interopRequireDefault(__nccwpck_require__(2438));
18
- var _plugins = __nccwpck_require__(9490);
19
- var _utils = __nccwpck_require__(9166);
17
+ var _options = _interopRequireDefault(__nccwpck_require__(3087));
18
+ var _plugins = __nccwpck_require__(4077);
19
+ var _utils = __nccwpck_require__(3004);
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
- 9490: (__unused_webpack_module, exports, __nccwpck_require__) => {
246
+ 4077: (__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__(2782),
268
+ __nccwpck_require__(1252),
269
269
  );
270
270
  var _postcssIcssParser = _interopRequireDefault(
271
- __nccwpck_require__(1885),
271
+ __nccwpck_require__(3170),
272
272
  );
273
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4908));
273
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4706));
274
274
  function _interopRequireDefault(obj) {
275
275
  return obj && obj.__esModule ? obj : { default: obj };
276
276
  }
277
277
  },
278
- 1885: (__unused_webpack_module, exports, __nccwpck_require__) => {
278
+ 3170: (__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__(8406);
283
- var _utils = __nccwpck_require__(9166);
283
+ var _utils = __nccwpck_require__(3004);
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
- 2782: (__unused_webpack_module, exports, __nccwpck_require__) => {
382
+ 1252: (__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__(7555),
388
388
  );
389
- var _utils = __nccwpck_require__(9166);
389
+ var _utils = __nccwpck_require__(3004);
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
- 4908: (__unused_webpack_module, exports, __nccwpck_require__) => {
694
+ 4706: (__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__(7555),
700
700
  );
701
- var _utils = __nccwpck_require__(9166);
701
+ var _utils = __nccwpck_require__(3004);
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
- 9166: (__unused_webpack_module, exports, __nccwpck_require__) => {
1044
+ 3004: (__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;
@@ -7960,7 +7960,7 @@
7960
7960
  "use strict";
7961
7961
  module.exports = require("util");
7962
7962
  },
7963
- 2438: (module) => {
7963
+ 3087: (module) => {
7964
7964
  "use strict";
7965
7965
  module.exports = JSON.parse(
7966
7966
  '{"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"}',
@@ -7995,6 +7995,6 @@
7995
7995
  }
7996
7996
  if (typeof __nccwpck_require__ !== "undefined")
7997
7997
  __nccwpck_require__.ab = __dirname + "/";
7998
- var __webpack_exports__ = __nccwpck_require__(2358);
7998
+ var __webpack_exports__ = __nccwpck_require__(6754);
7999
7999
  module.exports = __webpack_exports__;
8000
8000
  })();
@@ -16,8 +16,13 @@ declare class HtmlRspackPlugin {
16
16
 
17
17
  apply(compiler: Compiler): void;
18
18
 
19
+ /**
20
+ * @deprecated use `getCompilationHooks` instead
21
+ */
19
22
  static getHooks(compilation: Compilation): HtmlRspackPlugin.Hooks;
20
23
 
24
+ static getCompilationHooks(compilation: Compilation): HtmlRspackPlugin.Hooks;
25
+
21
26
  /**
22
27
  * Static helper to create a tag object to be get injected into the dom
23
28
  */
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 241: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 909: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(361);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(903);
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
- 361: (module) => {
307
+ 903: (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
- 479: (module) => {
476
+ 78: (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
- 135: (module) => {
495
+ 422: (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
- 935: (module, __unused_webpack_exports, __nccwpck_require__) => {
516
+ 9: (module, __unused_webpack_exports, __nccwpck_require__) => {
517
517
  "use strict";
518
518
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(348);
519
519
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -539,7 +539,7 @@
539
539
  }
540
540
  module.exports = { getHtmlRspackPluginHooks };
541
541
  },
542
- 697: (module) => {
542
+ 301: (module) => {
543
543
  const voidTags = [
544
544
  "area",
545
545
  "base",
@@ -607,19 +607,19 @@
607
607
  htmlTagObjectToString,
608
608
  };
609
609
  },
610
- 922: (module, __unused_webpack_exports, __nccwpck_require__) => {
610
+ 541: (module, __unused_webpack_exports, __nccwpck_require__) => {
611
611
  "use strict";
612
612
  const promisify = __nccwpck_require__(837).promisify;
613
613
  const vm = __nccwpck_require__(144);
614
614
  const fs = __nccwpck_require__(147);
615
615
  const path = __nccwpck_require__(17);
616
- const { CachedChildCompilation } = __nccwpck_require__(241);
616
+ const { CachedChildCompilation } = __nccwpck_require__(909);
617
617
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
618
- __nccwpck_require__(697);
619
- const prettyError = __nccwpck_require__(135);
620
- const chunkSorter = __nccwpck_require__(479);
618
+ __nccwpck_require__(301);
619
+ const prettyError = __nccwpck_require__(422);
620
+ const chunkSorter = __nccwpck_require__(78);
621
621
  const getHtmlRspackPluginHooks =
622
- __nccwpck_require__(935).getHtmlRspackPluginHooks;
622
+ __nccwpck_require__(9).getHtmlRspackPluginHooks;
623
623
  class HtmlRspackPlugin {
624
624
  constructor(userOptions = {}) {
625
625
  this.version = HtmlRspackPlugin.version;
@@ -1265,7 +1265,7 @@
1265
1265
  fileContent,
1266
1266
  compilation,
1267
1267
  ) {
1268
- if (/\[\\*([\w:]+)\\*\]/i.test(filename) === false) {
1268
+ if (/\[(?:[\w:]+)\]/.test(filename) === false) {
1269
1269
  return { path: filename, info: {} };
1270
1270
  }
1271
1271
  const hash = compiler.webpack.util.createHash(
@@ -1530,6 +1530,7 @@
1530
1530
  };
1531
1531
  }
1532
1532
  HtmlRspackPlugin.version = 6;
1533
+ HtmlRspackPlugin.getCompilationHooks = getHtmlRspackPluginHooks;
1533
1534
  HtmlRspackPlugin.getHooks = getHtmlRspackPluginHooks;
1534
1535
  HtmlRspackPlugin.createHtmlTagObject = createHtmlTagObject;
1535
1536
  module.exports = HtmlRspackPlugin;
@@ -1577,6 +1578,6 @@
1577
1578
  }
1578
1579
  if (typeof __nccwpck_require__ !== "undefined")
1579
1580
  __nccwpck_require__.ab = __dirname + "/";
1580
- var __webpack_exports__ = __nccwpck_require__(922);
1581
+ var __webpack_exports__ = __nccwpck_require__(541);
1581
1582
  module.exports = __webpack_exports__;
1582
1583
  })();
@@ -1 +1 @@
1
- {"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.0.1","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.2","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -2,7 +2,7 @@ type Formatter = (input: string | number | null | undefined) => string
2
2
 
3
3
  interface Colors {
4
4
  isColorSupported: boolean
5
-
5
+
6
6
  reset: Formatter
7
7
  bold: Formatter
8
8
  dim: Formatter
@@ -11,7 +11,7 @@ interface Colors {
11
11
  inverse: Formatter
12
12
  hidden: Formatter
13
13
  strikethrough: Formatter
14
-
14
+
15
15
  black: Formatter
16
16
  red: Formatter
17
17
  green: Formatter
@@ -21,7 +21,7 @@ interface Colors {
21
21
  cyan: Formatter
22
22
  white: Formatter
23
23
  gray: Formatter
24
-
24
+
25
25
  bgBlack: Formatter
26
26
  bgRed: Formatter
27
27
  bgGreen: Formatter
@@ -32,23 +32,22 @@ interface Colors {
32
32
  bgWhite: Formatter
33
33
 
34
34
  blackBright: Formatter
35
- redBright: Formatter
36
- greenBright: Formatter
37
- yellowBright: Formatter
38
- blueBright: Formatter
39
- magentaBright: Formatter
40
- cyanBright: Formatter
41
- whiteBright: Formatter
35
+ redBright: Formatter
36
+ greenBright: Formatter
37
+ yellowBright: Formatter
38
+ blueBright: Formatter
39
+ magentaBright: Formatter
40
+ cyanBright: Formatter
41
+ whiteBright: Formatter
42
42
 
43
43
  bgBlackBright: Formatter
44
- bgRedBright: Formatter
45
- bgGreenBright: Formatter
46
- bgYellowBright: Formatter
47
- bgBlueBright: Formatter
48
- bgMagentaBright: Formatter
49
- bgCyanBright: Formatter
50
- bgWhiteBright: Formatter
51
-
44
+ bgRedBright: Formatter
45
+ bgGreenBright: Formatter
46
+ bgYellowBright: Formatter
47
+ bgBlueBright: Formatter
48
+ bgMagentaBright: Formatter
49
+ bgCyanBright: Formatter
50
+ bgWhiteBright: Formatter
52
51
  }
53
52
 
54
53
  declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors }
@@ -1,29 +1,28 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 78: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
- let argv = process.argv || [],
5
- env = process.env;
3
+ 209: (module) => {
4
+ let p = process || {},
5
+ argv = p.argv || [],
6
+ env = p.env || {};
6
7
  let isColorSupported =
7
- !("NO_COLOR" in env || argv.includes("--no-color")) &&
8
- ("FORCE_COLOR" in env ||
8
+ !(!!env.NO_COLOR || argv.includes("--no-color")) &&
9
+ (!!env.FORCE_COLOR ||
9
10
  argv.includes("--color") ||
10
- process.platform === "win32" ||
11
- (require != null &&
12
- __nccwpck_require__(224).isatty(1) &&
13
- env.TERM !== "dumb") ||
14
- "CI" in env);
11
+ p.platform === "win32" ||
12
+ ((p.stdout || {}).isTTY && env.TERM !== "dumb") ||
13
+ !!env.CI);
15
14
  let formatter =
16
15
  (open, close, replace = open) =>
17
16
  (input) => {
18
- let string = "" + input;
19
- let index = string.indexOf(close, open.length);
17
+ let string = "" + input,
18
+ index = string.indexOf(close, open.length);
20
19
  return ~index
21
20
  ? open + replaceClose(string, close, replace, index) + close
22
21
  : open + string + close;
23
22
  };
24
23
  let replaceClose = (string, close, replace, index) => {
25
- let result = "";
26
- let cursor = 0;
24
+ let result = "",
25
+ cursor = 0;
27
26
  do {
28
27
  result += string.substring(cursor, index) + replace;
29
28
  cursor = index + close.length;
@@ -32,59 +31,55 @@
32
31
  return result + string.substring(cursor);
33
32
  };
34
33
  let createColors = (enabled = isColorSupported) => {
35
- let init = enabled ? formatter : () => String;
34
+ let f = enabled ? formatter : () => String;
36
35
  return {
37
36
  isColorSupported: enabled,
38
- reset: init("", ""),
39
- bold: init("", "", ""),
40
- dim: init("", "", ""),
41
- italic: init("", ""),
42
- underline: init("", ""),
43
- inverse: init("", ""),
44
- hidden: init("", ""),
45
- strikethrough: init("", ""),
46
- black: init("", ""),
47
- red: init("", ""),
48
- green: init("", ""),
49
- yellow: init("", ""),
50
- blue: init("", ""),
51
- magenta: init("", ""),
52
- cyan: init("", ""),
53
- white: init("", ""),
54
- gray: init("", ""),
55
- bgBlack: init("", ""),
56
- bgRed: init("", ""),
57
- bgGreen: init("", ""),
58
- bgYellow: init("", ""),
59
- bgBlue: init("", ""),
60
- bgMagenta: init("", ""),
61
- bgCyan: init("", ""),
62
- bgWhite: init("", ""),
63
- blackBright: init("", ""),
64
- redBright: init("", ""),
65
- greenBright: init("", ""),
66
- yellowBright: init("", ""),
67
- blueBright: init("", ""),
68
- magentaBright: init("", ""),
69
- cyanBright: init("", ""),
70
- whiteBright: init("", ""),
71
- bgBlackBright: init("", ""),
72
- bgRedBright: init("", ""),
73
- bgGreenBright: init("", ""),
74
- bgYellowBright: init("", ""),
75
- bgBlueBright: init("", ""),
76
- bgMagentaBright: init("", ""),
77
- bgCyanBright: init("", ""),
78
- bgWhiteBright: init("", ""),
37
+ reset: f("", ""),
38
+ bold: f("", "", ""),
39
+ dim: f("", "", ""),
40
+ italic: f("", ""),
41
+ underline: f("", ""),
42
+ inverse: f("", ""),
43
+ hidden: f("", ""),
44
+ strikethrough: f("", ""),
45
+ black: f("", ""),
46
+ red: f("", ""),
47
+ green: f("", ""),
48
+ yellow: f("", ""),
49
+ blue: f("", ""),
50
+ magenta: f("", ""),
51
+ cyan: f("", ""),
52
+ white: f("", ""),
53
+ gray: f("", ""),
54
+ bgBlack: f("", ""),
55
+ bgRed: f("", ""),
56
+ bgGreen: f("", ""),
57
+ bgYellow: f("", ""),
58
+ bgBlue: f("", ""),
59
+ bgMagenta: f("", ""),
60
+ bgCyan: f("", ""),
61
+ bgWhite: f("", ""),
62
+ blackBright: f("", ""),
63
+ redBright: f("", ""),
64
+ greenBright: f("", ""),
65
+ yellowBright: f("", ""),
66
+ blueBright: f("", ""),
67
+ magentaBright: f("", ""),
68
+ cyanBright: f("", ""),
69
+ whiteBright: f("", ""),
70
+ bgBlackBright: f("", ""),
71
+ bgRedBright: f("", ""),
72
+ bgGreenBright: f("", ""),
73
+ bgYellowBright: f("", ""),
74
+ bgBlueBright: f("", ""),
75
+ bgMagentaBright: f("", ""),
76
+ bgCyanBright: f("", ""),
77
+ bgWhiteBright: f("", ""),
79
78
  };
80
79
  };
81
80
  module.exports = createColors();
82
81
  module.exports.createColors = createColors;
83
82
  },
84
- 224: (module) => {
85
- "use strict";
86
- module.exports = require("tty");
87
- },
88
83
  };
89
84
  var __webpack_module_cache__ = {};
90
85
  function __nccwpck_require__(moduleId) {
@@ -108,6 +103,6 @@
108
103
  }
109
104
  if (typeof __nccwpck_require__ !== "undefined")
110
105
  __nccwpck_require__.ab = __dirname + "/";
111
- var __webpack_exports__ = __nccwpck_require__(78);
106
+ var __webpack_exports__ = __nccwpck_require__(209);
112
107
  module.exports = __webpack_exports__;
113
108
  })();
@@ -1 +1 @@
1
- {"name":"picocolors","author":"Alexey Raspopov","version":"1.1.0","license":"ISC","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"picocolors","author":"Alexey Raspopov","version":"1.1.1","license":"ISC","types":"index.d.ts","type":"commonjs"}
@@ -1,17 +1,17 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 533: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(646)["default"];
4
+ 777: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(779)["default"];
6
6
  },
7
- 646: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 779: (__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__(17));
12
12
  var _package = _interopRequireDefault(__nccwpck_require__(360));
13
- var _options = _interopRequireDefault(__nccwpck_require__(839));
14
- var _utils = __nccwpck_require__(107);
13
+ var _options = _interopRequireDefault(__nccwpck_require__(723));
14
+ var _utils = __nccwpck_require__(974);
15
15
  function _interopRequireDefault(obj) {
16
16
  return obj && obj.__esModule ? obj : { default: obj };
17
17
  }
@@ -189,7 +189,7 @@
189
189
  callback(null, result.css, map, { ast });
190
190
  }
191
191
  },
192
- 107: (module, exports, __nccwpck_require__) => {
192
+ 974: (module, exports, __nccwpck_require__) => {
193
193
  module = __nccwpck_require__.nmd(module);
194
194
  Object.defineProperty(exports, "__esModule", { value: true });
195
195
  exports.exec = exec;
@@ -691,7 +691,7 @@
691
691
  310: (module) => {
692
692
  module.exports = require("url");
693
693
  },
694
- 839: (module) => {
694
+ 723: (module) => {
695
695
  module.exports = JSON.parse(
696
696
  '{"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}',
697
697
  );
@@ -736,6 +736,6 @@
736
736
  })();
737
737
  if (typeof __nccwpck_require__ !== "undefined")
738
738
  __nccwpck_require__.ab = __dirname + "/";
739
- var __webpack_exports__ = __nccwpck_require__(533);
739
+ var __webpack_exports__ = __nccwpck_require__(777);
740
740
  module.exports = __webpack_exports__;
741
741
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 376: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 248: (__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
- 317: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 458: (__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__(147);
131
131
  const path_1 = __nccwpck_require__(17);
132
132
  const lite_tapable_1 = __nccwpck_require__(348);
133
- const helpers_1 = __nccwpck_require__(376);
133
+ const helpers_1 = __nccwpck_require__(248);
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__(17);
315
- const hooks_1 = __nccwpck_require__(317);
315
+ const hooks_1 = __nccwpck_require__(458);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
@@ -8903,30 +8903,29 @@
8903
8903
  return childProcess.execFile(command, args, options, callback);
8904
8904
  };
8905
8905
  },
8906
- 78: (module, __unused_webpack_exports, __nccwpck_require__) => {
8907
- let argv = process.argv || [],
8908
- env = process.env;
8906
+ 5209: (module) => {
8907
+ let p = process || {},
8908
+ argv = p.argv || [],
8909
+ env = p.env || {};
8909
8910
  let isColorSupported =
8910
- !("NO_COLOR" in env || argv.includes("--no-color")) &&
8911
- ("FORCE_COLOR" in env ||
8911
+ !(!!env.NO_COLOR || argv.includes("--no-color")) &&
8912
+ (!!env.FORCE_COLOR ||
8912
8913
  argv.includes("--color") ||
8913
- process.platform === "win32" ||
8914
- (require != null &&
8915
- __nccwpck_require__(6224).isatty(1) &&
8916
- env.TERM !== "dumb") ||
8917
- "CI" in env);
8914
+ p.platform === "win32" ||
8915
+ ((p.stdout || {}).isTTY && env.TERM !== "dumb") ||
8916
+ !!env.CI);
8918
8917
  let formatter =
8919
8918
  (open, close, replace = open) =>
8920
8919
  (input) => {
8921
- let string = "" + input;
8922
- let index = string.indexOf(close, open.length);
8920
+ let string = "" + input,
8921
+ index = string.indexOf(close, open.length);
8923
8922
  return ~index
8924
8923
  ? open + replaceClose(string, close, replace, index) + close
8925
8924
  : open + string + close;
8926
8925
  };
8927
8926
  let replaceClose = (string, close, replace, index) => {
8928
- let result = "";
8929
- let cursor = 0;
8927
+ let result = "",
8928
+ cursor = 0;
8930
8929
  do {
8931
8930
  result += string.substring(cursor, index) + replace;
8932
8931
  cursor = index + close.length;
@@ -8935,50 +8934,50 @@
8935
8934
  return result + string.substring(cursor);
8936
8935
  };
8937
8936
  let createColors = (enabled = isColorSupported) => {
8938
- let init = enabled ? formatter : () => String;
8937
+ let f = enabled ? formatter : () => String;
8939
8938
  return {
8940
8939
  isColorSupported: enabled,
8941
- reset: init("", ""),
8942
- bold: init("", "", ""),
8943
- dim: init("", "", ""),
8944
- italic: init("", ""),
8945
- underline: init("", ""),
8946
- inverse: init("", ""),
8947
- hidden: init("", ""),
8948
- strikethrough: init("", ""),
8949
- black: init("", ""),
8950
- red: init("", ""),
8951
- green: init("", ""),
8952
- yellow: init("", ""),
8953
- blue: init("", ""),
8954
- magenta: init("", ""),
8955
- cyan: init("", ""),
8956
- white: init("", ""),
8957
- gray: init("", ""),
8958
- bgBlack: init("", ""),
8959
- bgRed: init("", ""),
8960
- bgGreen: init("", ""),
8961
- bgYellow: init("", ""),
8962
- bgBlue: init("", ""),
8963
- bgMagenta: init("", ""),
8964
- bgCyan: init("", ""),
8965
- bgWhite: init("", ""),
8966
- blackBright: init("", ""),
8967
- redBright: init("", ""),
8968
- greenBright: init("", ""),
8969
- yellowBright: init("", ""),
8970
- blueBright: init("", ""),
8971
- magentaBright: init("", ""),
8972
- cyanBright: init("", ""),
8973
- whiteBright: init("", ""),
8974
- bgBlackBright: init("", ""),
8975
- bgRedBright: init("", ""),
8976
- bgGreenBright: init("", ""),
8977
- bgYellowBright: init("", ""),
8978
- bgBlueBright: init("", ""),
8979
- bgMagentaBright: init("", ""),
8980
- bgCyanBright: init("", ""),
8981
- bgWhiteBright: init("", ""),
8940
+ reset: f("", ""),
8941
+ bold: f("", "", ""),
8942
+ dim: f("", "", ""),
8943
+ italic: f("", ""),
8944
+ underline: f("", ""),
8945
+ inverse: f("", ""),
8946
+ hidden: f("", ""),
8947
+ strikethrough: f("", ""),
8948
+ black: f("", ""),
8949
+ red: f("", ""),
8950
+ green: f("", ""),
8951
+ yellow: f("", ""),
8952
+ blue: f("", ""),
8953
+ magenta: f("", ""),
8954
+ cyan: f("", ""),
8955
+ white: f("", ""),
8956
+ gray: f("", ""),
8957
+ bgBlack: f("", ""),
8958
+ bgRed: f("", ""),
8959
+ bgGreen: f("", ""),
8960
+ bgYellow: f("", ""),
8961
+ bgBlue: f("", ""),
8962
+ bgMagenta: f("", ""),
8963
+ bgCyan: f("", ""),
8964
+ bgWhite: f("", ""),
8965
+ blackBright: f("", ""),
8966
+ redBright: f("", ""),
8967
+ greenBright: f("", ""),
8968
+ yellowBright: f("", ""),
8969
+ blueBright: f("", ""),
8970
+ magentaBright: f("", ""),
8971
+ cyanBright: f("", ""),
8972
+ whiteBright: f("", ""),
8973
+ bgBlackBright: f("", ""),
8974
+ bgRedBright: f("", ""),
8975
+ bgGreenBright: f("", ""),
8976
+ bgYellowBright: f("", ""),
8977
+ bgBlueBright: f("", ""),
8978
+ bgMagentaBright: f("", ""),
8979
+ bgCyanBright: f("", ""),
8980
+ bgWhiteBright: f("", ""),
8982
8981
  };
8983
8982
  };
8984
8983
  module.exports = createColors();
@@ -9180,7 +9179,7 @@
9180
9179
  "use strict";
9181
9180
  const fs = __nccwpck_require__(7147);
9182
9181
  const path = __nccwpck_require__(1017);
9183
- const { bold } = __nccwpck_require__(78);
9182
+ const { bold } = __nccwpck_require__(5209);
9184
9183
  const Logger = __nccwpck_require__(1283);
9185
9184
  const viewer = __nccwpck_require__(7498);
9186
9185
  const utils = __nccwpck_require__(5554);
@@ -10522,7 +10521,7 @@
10522
10521
  const http = __nccwpck_require__(3685);
10523
10522
  const WebSocket = __nccwpck_require__(6057);
10524
10523
  const sirv = __nccwpck_require__(2486);
10525
- const { bold } = __nccwpck_require__(78);
10524
+ const { bold } = __nccwpck_require__(5209);
10526
10525
  const Logger = __nccwpck_require__(1283);
10527
10526
  const analyzer = __nccwpck_require__(3377);
10528
10527
  const { open } = __nccwpck_require__(5554);
@@ -13284,10 +13283,6 @@
13284
13283
  "use strict";
13285
13284
  module.exports = require("tls");
13286
13285
  },
13287
- 6224: (module) => {
13288
- "use strict";
13289
- module.exports = require("tty");
13290
- },
13291
13286
  7310: (module) => {
13292
13287
  "use strict";
13293
13288
  module.exports = require("url");
package/dist/index.cjs CHANGED
@@ -5728,11 +5728,31 @@ function initPluginAPI({
5728
5728
  let transformId = 0;
5729
5729
  const transformer = {};
5730
5730
  const processAssetsFns = [];
5731
+ const resolveFns = [];
5731
5732
  hooks.modifyBundlerChain.tap((chain, { target, environment }) => {
5732
5733
  const pluginName = "RsbuildCorePlugin";
5733
5734
  class RsbuildCorePlugin {
5734
5735
  apply(compiler) {
5735
5736
  compiler.__rsbuildTransformer = transformer;
5737
+ for (const { handler, environment: pluginEnvironment } of resolveFns) {
5738
+ if (pluginEnvironment && !isPluginMatchEnvironment(pluginEnvironment, environment.name)) {
5739
+ return;
5740
+ }
5741
+ compiler.hooks.compilation.tap(
5742
+ pluginName,
5743
+ (compilation, { normalModuleFactory }) => {
5744
+ normalModuleFactory.hooks.resolve.tapPromise(
5745
+ pluginName,
5746
+ async (resolveData) => handler({
5747
+ compiler,
5748
+ compilation,
5749
+ environment,
5750
+ resolveData
5751
+ })
5752
+ );
5753
+ }
5754
+ );
5755
+ }
5736
5756
  compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
5737
5757
  compilation.hooks.childCompiler.tap(pluginName, (childCompiler) => {
5738
5758
  childCompiler.__rsbuildTransformer = transformer;
@@ -5800,6 +5820,9 @@ function initPluginAPI({
5800
5820
  const setProcessAssets = (environment) => (descriptor, handler) => {
5801
5821
  processAssetsFns.push({ environment, descriptor, handler });
5802
5822
  };
5823
+ const setResolve = (environment) => (handler) => {
5824
+ resolveFns.push({ environment, handler });
5825
+ };
5803
5826
  let onExitListened = false;
5804
5827
  const onExit = (cb) => {
5805
5828
  if (!onExitListened) {
@@ -5816,6 +5839,7 @@ function initPluginAPI({
5816
5839
  transform: getTransformFn(environment),
5817
5840
  useExposed,
5818
5841
  processAssets: setProcessAssets(environment),
5842
+ resolve: setResolve(environment),
5819
5843
  getRsbuildConfig,
5820
5844
  getNormalizedConfig,
5821
5845
  isPluginExists: pluginManager.isPluginExists,
@@ -6018,7 +6042,7 @@ async function createContext(options, userConfig, bundlerType) {
6018
6042
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6019
6043
  const cachePath = (0, import_node_path10.join)(rootPath, "node_modules", ".cache");
6020
6044
  return {
6021
- version: "1.0.15",
6045
+ version: "1.0.17",
6022
6046
  rootPath,
6023
6047
  distPath: "",
6024
6048
  cachePath,
@@ -6504,6 +6528,16 @@ async function getConfigUtils(config, chainUtils) {
6504
6528
  }
6505
6529
  config.module.rules.unshift(...ruleArr);
6506
6530
  },
6531
+ appendRules(rules) {
6532
+ const ruleArr = castArray(rules);
6533
+ if (!config.module) {
6534
+ config.module = {};
6535
+ }
6536
+ if (!config.module.rules) {
6537
+ config.module.rules = [];
6538
+ }
6539
+ config.module.rules.push(...ruleArr);
6540
+ },
6507
6541
  prependPlugins(plugins) {
6508
6542
  const pluginArr = castArray(plugins);
6509
6543
  if (!config.plugins) {
@@ -9767,7 +9801,7 @@ function getPublicPath({
9767
9801
  config,
9768
9802
  context
9769
9803
  }) {
9770
- const { dev, output } = config;
9804
+ const { dev, output, server } = config;
9771
9805
  let publicPath = DEFAULT_ASSET_PREFIX;
9772
9806
  const port = context.devServer?.port || DEFAULT_PORT;
9773
9807
  if (isProd) {
@@ -9785,6 +9819,9 @@ function getPublicPath({
9785
9819
  } else {
9786
9820
  publicPath = `${protocol}://${hostname}:<port>/`;
9787
9821
  }
9822
+ if (server.base && server.base !== "/") {
9823
+ publicPath = urlJoin(publicPath, server.base);
9824
+ }
9788
9825
  }
9789
9826
  return formatPublicPath(replacePortPlaceholder(publicPath, port));
9790
9827
  }
@@ -9853,11 +9890,18 @@ var init_output = __esm({
9853
9890
  const extractPluginOptions = config.tools.cssExtract.pluginOptions;
9854
9891
  const cssPath = config.output.distPath.css;
9855
9892
  const cssFilename = getFilename(config, "css", isProd);
9893
+ const isCssFilenameFn = typeof cssFilename === "function";
9856
9894
  const cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : "async");
9857
9895
  chain.plugin(CHAIN_ID2.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
9858
9896
  {
9859
- filename: import_node_path22.posix.join(cssPath, cssFilename),
9860
- chunkFilename: import_node_path22.posix.join(cssAsyncPath, cssFilename),
9897
+ filename: isCssFilenameFn ? (...args) => {
9898
+ const name = cssFilename(...args);
9899
+ return import_node_path22.posix.join(cssPath, name);
9900
+ } : import_node_path22.posix.join(cssPath, cssFilename),
9901
+ chunkFilename: isCssFilenameFn ? (...args) => {
9902
+ const name = cssFilename(...args);
9903
+ return import_node_path22.posix.join(cssAsyncPath, name);
9904
+ } : import_node_path22.posix.join(cssAsyncPath, cssFilename),
9861
9905
  ...extractPluginOptions
9862
9906
  }
9863
9907
  ]);
@@ -12599,10 +12643,16 @@ function pluginModuleFederation() {
12599
12643
  if (!moduleFederation?.options) {
12600
12644
  return;
12601
12645
  }
12602
- if (moduleFederation.options.exposes && config.server?.port && !config.dev?.client?.port) {
12646
+ if (moduleFederation.options.exposes) {
12603
12647
  config.dev ||= {};
12604
- config.dev.client ||= {};
12605
- config.dev.client.port = config.server.port;
12648
+ if (config.server?.port && !config.dev.client?.port) {
12649
+ config.dev.client ||= {};
12650
+ config.dev.client.port = config.server.port;
12651
+ }
12652
+ const originalConfig = api.getRsbuildConfig("original");
12653
+ if (originalConfig.dev?.assetPrefix === void 0 && config.dev.assetPrefix === config.server?.base) {
12654
+ config.dev.assetPrefix = true;
12655
+ }
12606
12656
  }
12607
12657
  });
12608
12658
  api.modifyEnvironmentConfig((config) => {
@@ -12637,10 +12687,6 @@ function pluginModuleFederation() {
12637
12687
  chain.output.set("uniqueName", options.name);
12638
12688
  }
12639
12689
  }
12640
- const publicPath = chain.output.get("publicPath");
12641
- if (publicPath === DEFAULT_ASSET_PREFIX) {
12642
- chain.output.set("publicPath", "auto");
12643
- }
12644
12690
  }
12645
12691
  );
12646
12692
  }
@@ -12652,7 +12698,6 @@ var init_moduleFederation = __esm({
12652
12698
  "use strict";
12653
12699
  import_types2 = require("util/types");
12654
12700
  import_core8 = require("@rspack/core");
12655
- init_constants();
12656
12701
  PatchSplitChunksPlugin = class {
12657
12702
  constructor(name) {
12658
12703
  __publicField(this, "name");
@@ -13564,7 +13609,7 @@ var init_init = __esm({
13564
13609
 
13565
13610
  // src/cli/commands.ts
13566
13611
  function runCli() {
13567
- program.name("rsbuild").usage("<command> [options]").version("1.0.15");
13612
+ program.name("rsbuild").usage("<command> [options]").version("1.0.17");
13568
13613
  const devCommand = program.command("dev");
13569
13614
  const buildCommand = program.command("build");
13570
13615
  const previewCommand = program.command("preview");
@@ -13673,7 +13718,7 @@ function prepareCli() {
13673
13718
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13674
13719
  console.log();
13675
13720
  }
13676
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.15"}`}
13721
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.17"}`}
13677
13722
  `);
13678
13723
  }
13679
13724
  var import_node_module;
@@ -13759,7 +13804,7 @@ init_logger();
13759
13804
  init_mergeConfig();
13760
13805
  init_helpers();
13761
13806
  init_constants();
13762
- var version = "1.0.15";
13807
+ var version = "1.0.17";
13763
13808
  // Annotate the CommonJS export names for ESM import in node:
13764
13809
  0 && (module.exports = {
13765
13810
  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.60.3_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js
49
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.60.4_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js
50
50
  import path from "path";
51
51
  import { fileURLToPath } from "url";
52
52
  var getFilename, getDirname, __dirname, __filename;
53
53
  var init_esm = __esm({
54
- "../../node_modules/.pnpm/@modern-js+module-tools@2.60.3_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
54
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.60.4_typescript@5.6.3/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());
@@ -5776,11 +5776,31 @@ function initPluginAPI({
5776
5776
  let transformId = 0;
5777
5777
  const transformer = {};
5778
5778
  const processAssetsFns = [];
5779
+ const resolveFns = [];
5779
5780
  hooks.modifyBundlerChain.tap((chain, { target, environment }) => {
5780
5781
  const pluginName = "RsbuildCorePlugin";
5781
5782
  class RsbuildCorePlugin {
5782
5783
  apply(compiler) {
5783
5784
  compiler.__rsbuildTransformer = transformer;
5785
+ for (const { handler, environment: pluginEnvironment } of resolveFns) {
5786
+ if (pluginEnvironment && !isPluginMatchEnvironment(pluginEnvironment, environment.name)) {
5787
+ return;
5788
+ }
5789
+ compiler.hooks.compilation.tap(
5790
+ pluginName,
5791
+ (compilation, { normalModuleFactory }) => {
5792
+ normalModuleFactory.hooks.resolve.tapPromise(
5793
+ pluginName,
5794
+ async (resolveData) => handler({
5795
+ compiler,
5796
+ compilation,
5797
+ environment,
5798
+ resolveData
5799
+ })
5800
+ );
5801
+ }
5802
+ );
5803
+ }
5784
5804
  compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
5785
5805
  compilation.hooks.childCompiler.tap(pluginName, (childCompiler) => {
5786
5806
  childCompiler.__rsbuildTransformer = transformer;
@@ -5848,6 +5868,9 @@ function initPluginAPI({
5848
5868
  const setProcessAssets = (environment) => (descriptor, handler) => {
5849
5869
  processAssetsFns.push({ environment, descriptor, handler });
5850
5870
  };
5871
+ const setResolve = (environment) => (handler) => {
5872
+ resolveFns.push({ environment, handler });
5873
+ };
5851
5874
  let onExitListened = false;
5852
5875
  const onExit = (cb) => {
5853
5876
  if (!onExitListened) {
@@ -5864,6 +5887,7 @@ function initPluginAPI({
5864
5887
  transform: getTransformFn(environment),
5865
5888
  useExposed,
5866
5889
  processAssets: setProcessAssets(environment),
5890
+ resolve: setResolve(environment),
5867
5891
  getRsbuildConfig,
5868
5892
  getNormalizedConfig,
5869
5893
  isPluginExists: pluginManager.isPluginExists,
@@ -6067,7 +6091,7 @@ async function createContext(options, userConfig, bundlerType) {
6067
6091
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6068
6092
  const cachePath = join6(rootPath, "node_modules", ".cache");
6069
6093
  return {
6070
- version: "1.0.15",
6094
+ version: "1.0.17",
6071
6095
  rootPath,
6072
6096
  distPath: "",
6073
6097
  cachePath,
@@ -6559,6 +6583,16 @@ async function getConfigUtils(config, chainUtils) {
6559
6583
  }
6560
6584
  config.module.rules.unshift(...ruleArr);
6561
6585
  },
6586
+ appendRules(rules) {
6587
+ const ruleArr = castArray(rules);
6588
+ if (!config.module) {
6589
+ config.module = {};
6590
+ }
6591
+ if (!config.module.rules) {
6592
+ config.module.rules = [];
6593
+ }
6594
+ config.module.rules.push(...ruleArr);
6595
+ },
6562
6596
  prependPlugins(plugins) {
6563
6597
  const pluginArr = castArray(plugins);
6564
6598
  if (!config.plugins) {
@@ -9850,7 +9884,7 @@ function getPublicPath({
9850
9884
  config,
9851
9885
  context
9852
9886
  }) {
9853
- const { dev, output } = config;
9887
+ const { dev, output, server } = config;
9854
9888
  let publicPath = DEFAULT_ASSET_PREFIX;
9855
9889
  const port = context.devServer?.port || DEFAULT_PORT;
9856
9890
  if (isProd) {
@@ -9868,6 +9902,9 @@ function getPublicPath({
9868
9902
  } else {
9869
9903
  publicPath = `${protocol}://${hostname}:<port>/`;
9870
9904
  }
9905
+ if (server.base && server.base !== "/") {
9906
+ publicPath = urlJoin(publicPath, server.base);
9907
+ }
9871
9908
  }
9872
9909
  return formatPublicPath(replacePortPlaceholder(publicPath, port));
9873
9910
  }
@@ -9935,11 +9972,18 @@ var init_output = __esm({
9935
9972
  const extractPluginOptions = config.tools.cssExtract.pluginOptions;
9936
9973
  const cssPath = config.output.distPath.css;
9937
9974
  const cssFilename = getFilename2(config, "css", isProd);
9975
+ const isCssFilenameFn = typeof cssFilename === "function";
9938
9976
  const cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : "async");
9939
9977
  chain.plugin(CHAIN_ID2.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
9940
9978
  {
9941
- filename: posix4.join(cssPath, cssFilename),
9942
- chunkFilename: posix4.join(cssAsyncPath, cssFilename),
9979
+ filename: isCssFilenameFn ? (...args) => {
9980
+ const name = cssFilename(...args);
9981
+ return posix4.join(cssPath, name);
9982
+ } : posix4.join(cssPath, cssFilename),
9983
+ chunkFilename: isCssFilenameFn ? (...args) => {
9984
+ const name = cssFilename(...args);
9985
+ return posix4.join(cssAsyncPath, name);
9986
+ } : posix4.join(cssAsyncPath, cssFilename),
9943
9987
  ...extractPluginOptions
9944
9988
  }
9945
9989
  ]);
@@ -12711,10 +12755,16 @@ function pluginModuleFederation() {
12711
12755
  if (!moduleFederation?.options) {
12712
12756
  return;
12713
12757
  }
12714
- if (moduleFederation.options.exposes && config.server?.port && !config.dev?.client?.port) {
12758
+ if (moduleFederation.options.exposes) {
12715
12759
  config.dev ||= {};
12716
- config.dev.client ||= {};
12717
- config.dev.client.port = config.server.port;
12760
+ if (config.server?.port && !config.dev.client?.port) {
12761
+ config.dev.client ||= {};
12762
+ config.dev.client.port = config.server.port;
12763
+ }
12764
+ const originalConfig = api.getRsbuildConfig("original");
12765
+ if (originalConfig.dev?.assetPrefix === void 0 && config.dev.assetPrefix === config.server?.base) {
12766
+ config.dev.assetPrefix = true;
12767
+ }
12718
12768
  }
12719
12769
  });
12720
12770
  api.modifyEnvironmentConfig((config) => {
@@ -12749,10 +12799,6 @@ function pluginModuleFederation() {
12749
12799
  chain.output.set("uniqueName", options.name);
12750
12800
  }
12751
12801
  }
12752
- const publicPath = chain.output.get("publicPath");
12753
- if (publicPath === DEFAULT_ASSET_PREFIX) {
12754
- chain.output.set("publicPath", "auto");
12755
- }
12756
12802
  }
12757
12803
  );
12758
12804
  }
@@ -12763,7 +12809,6 @@ var init_moduleFederation = __esm({
12763
12809
  "src/plugins/moduleFederation.ts"() {
12764
12810
  "use strict";
12765
12811
  init_esm();
12766
- init_constants();
12767
12812
  PatchSplitChunksPlugin = class {
12768
12813
  constructor(name) {
12769
12814
  __publicField(this, "name");
@@ -13682,7 +13727,7 @@ var init_init = __esm({
13682
13727
 
13683
13728
  // src/cli/commands.ts
13684
13729
  function runCli() {
13685
- program.name("rsbuild").usage("<command> [options]").version("1.0.15");
13730
+ program.name("rsbuild").usage("<command> [options]").version("1.0.17");
13686
13731
  const devCommand = program.command("dev");
13687
13732
  const buildCommand = program.command("build");
13688
13733
  const previewCommand = program.command("preview");
@@ -13793,7 +13838,7 @@ function prepareCli() {
13793
13838
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13794
13839
  console.log();
13795
13840
  }
13796
- logger.greet(` ${`Rsbuild v${"1.0.15"}`}
13841
+ logger.greet(` ${`Rsbuild v${"1.0.17"}`}
13797
13842
  `);
13798
13843
  }
13799
13844
  var init_prepare = __esm({
@@ -13864,7 +13909,7 @@ init_mergeConfig();
13864
13909
  init_helpers();
13865
13910
  init_constants();
13866
13911
  import { rspack as rspack10 } from "@rspack/core";
13867
- var version = "1.0.15";
13912
+ var version = "1.0.17";
13868
13913
  export {
13869
13914
  PLUGIN_CSS_NAME,
13870
13915
  PLUGIN_SWC_NAME,
@@ -20,10 +20,12 @@ export declare const addTrailingSlash: (s: string) => string;
20
20
  export declare const formatPublicPath: (publicPath: string, withSlash?: boolean) => string;
21
21
  export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: boolean) => string;
22
22
  export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
23
+ export declare const urlJoin: (base: string, path: string) => string;
23
24
  export declare const canParse: (url: string) => boolean;
24
25
  export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
25
26
  export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): NonNullable<FilenameConfig['js']>;
26
- export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js'>, isProd: boolean, isServer?: boolean): string;
27
+ export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean): NonNullable<FilenameConfig['css']>;
28
+ export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js' | 'css'>, isProd: boolean, isServer?: boolean): string;
27
29
  export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
28
30
  export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
29
31
  export declare const upperFirst: (str: string) => string;
@@ -25,6 +25,7 @@ export type ToolsHtmlPluginConfig = ConfigChainWithContext<HtmlRspackPlugin.Opti
25
25
  }>;
26
26
  export type ModifyRspackConfigUtils = ModifyChainUtils & {
27
27
  addRules: (rules: RspackRule | RspackRule[]) => void;
28
+ appendRules: (rules: RspackRule | RspackRule[]) => void;
28
29
  prependPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
29
30
  appendPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
30
31
  removePlugin: (pluginName: string) => void;
@@ -495,7 +496,7 @@ export type FilenameConfig = {
495
496
  * - dev: '[name].css'
496
497
  * - prod: '[name].[contenthash:8].css'
497
498
  */
498
- css?: string;
499
+ css?: NonNullable<Rspack.Configuration['output']>['cssFilename'];
499
500
  /**
500
501
  * The name of the SVG images.
501
502
  * @default '[name].[contenthash:8].svg'
@@ -51,6 +51,7 @@ export type ModifyWebpackChainUtils = ModifyChainUtils & {
51
51
  };
52
52
  export type ModifyWebpackConfigUtils = ModifyWebpackChainUtils & {
53
53
  addRules: (rules: RuleSetRule | RuleSetRule[]) => void;
54
+ appendRules: (rules: RuleSetRule | RuleSetRule[]) => void;
54
55
  prependPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
55
56
  appendPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
56
57
  removePlugin: (pluginName: string) => void;
@@ -193,7 +194,7 @@ export type TransformDescriptor = {
193
194
  resourceQuery?: Rspack.RuleSetCondition;
194
195
  /**
195
196
  * Match based on the Rsbuild targets and only apply the transform to certain targets.
196
- * @see https://rsbuild.dev/config/output/targets
197
+ * @see https://rsbuild.dev/config/output/target
197
198
  */
198
199
  targets?: RsbuildTarget[];
199
200
  /**
@@ -216,7 +217,7 @@ export type ProcessAssetsDescriptor = {
216
217
  stage: ProcessAssetsStage;
217
218
  /**
218
219
  * Match based on the Rsbuild targets and only process the assets of certain targets.
219
- * @see https://rsbuild.dev/config/output/targets
220
+ * @see https://rsbuild.dev/config/output/target
220
221
  */
221
222
  targets?: RsbuildTarget[];
222
223
  /**
@@ -239,6 +240,15 @@ export type ProcessAssetsHandler = (context: {
239
240
  */
240
241
  sources: RspackSources;
241
242
  }) => Promise<void> | void;
243
+ export type ResolveHandler = (context: {
244
+ /** Module request information */
245
+ resolveData: Rspack.ResolveData;
246
+ /** The environment context for current build. */
247
+ environment: EnvironmentContext;
248
+ compiler: Rspack.Compiler;
249
+ compilation: Rspack.Compilation;
250
+ }) => Promise<void> | void;
251
+ export type ResolveFn = (handler: ResolveHandler) => void;
242
252
  export type ProcessAssetsFn = (descriptor: ProcessAssetsDescriptor, handler: ProcessAssetsHandler) => void;
243
253
  declare function getNormalizedConfig(): NormalizedConfig;
244
254
  declare function getNormalizedConfig(options: {
@@ -288,5 +298,9 @@ export type RsbuildPluginAPI = Readonly<{
288
298
  * Process all the asset generated by Rspack.
289
299
  */
290
300
  processAssets: ProcessAssetsFn;
301
+ /**
302
+ * Defines a custom resolver. A resolver can be useful for e.g. locating third-party dependencies.
303
+ */
304
+ resolve: ResolveFn;
291
305
  }>;
292
306
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "~1.0.13",
49
+ "@rspack/core": "~1.0.14",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.13",
52
52
  "core-js": "~3.38.1"
@@ -68,14 +68,14 @@
68
68
  "dotenv": "16.4.5",
69
69
  "dotenv-expand": "11.0.6",
70
70
  "fs-extra": "^11.2.0",
71
- "html-rspack-plugin": "6.0.1",
71
+ "html-rspack-plugin": "6.0.2",
72
72
  "http-proxy-middleware": "^2.0.6",
73
73
  "jiti": "^1.21.6",
74
74
  "launch-editor-middleware": "^2.9.1",
75
75
  "mrmime": "^2.0.0",
76
76
  "on-finished": "2.4.1",
77
77
  "open": "^8.4.0",
78
- "picocolors": "^1.1.0",
78
+ "picocolors": "^1.1.1",
79
79
  "postcss": "^8.4.47",
80
80
  "postcss-load-config": "6.0.1",
81
81
  "postcss-loader": "8.1.1",