@rsbuild/core 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3734,7 +3734,7 @@ function pick(obj, keys) {
3734
3734
  {}
3735
3735
  );
3736
3736
  }
3737
- var import_node_path4, import_deepmerge, import_picocolors3, rspackMinVersion, getNodeEnv, setNodeEnv, isFunction, isObject, isPlainObject, castArray, cloneDeep, compareSemver, isSatisfyRspackVersion, removeLeadingSlash, removeTailingSlash, addTrailingSlash, formatPublicPath, getPublicPathFromChain, getPublicPathFromCompiler, urlJoin, canParse, ensureAssetPrefix, applyToCompiler, upperFirst, isURL, createVirtualModule, isMultiCompiler, camelCase, prettyTime;
3737
+ var import_node_path4, import_deepmerge, import_picocolors3, rspackMinVersion, getNodeEnv, setNodeEnv, isFunction, isObject, isPlainObject, castArray, cloneDeep, compareSemver, isSatisfyRspackVersion, removeLeadingSlash, removeTailingSlash, addTrailingSlash, formatPublicPath, getPublicPathFromChain, getPublicPathFromCompiler, urlJoin, canParse, ensureAssetPrefix, applyToCompiler, upperFirst, isURL, createVirtualModule, isMultiCompiler, camelCase, prettyTime, isTTY;
3738
3738
  var init_helpers = __esm({
3739
3739
  "src/helpers/index.ts"() {
3740
3740
  "use strict";
@@ -3752,19 +3752,8 @@ var init_helpers = __esm({
3752
3752
  };
3753
3753
  isFunction = (func) => typeof func === "function";
3754
3754
  isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
3755
- isPlainObject = (o) => {
3756
- if (isObject(o) === false)
3757
- return false;
3758
- const ctor = o.constructor;
3759
- if (ctor === void 0)
3760
- return true;
3761
- const prot = ctor.prototype;
3762
- if (isObject(prot) === false)
3763
- return false;
3764
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
3765
- return false;
3766
- }
3767
- return true;
3755
+ isPlainObject = (obj) => {
3756
+ return obj !== null && typeof obj === "object" && Object.getPrototypeOf(obj) === Object.prototype;
3768
3757
  };
3769
3758
  castArray = (arr) => {
3770
3759
  if (arr === void 0) {
@@ -3891,6 +3880,9 @@ var init_helpers = __esm({
3891
3880
  const minutes = seconds / 60;
3892
3881
  return `${format(minutes.toFixed(2))} m`;
3893
3882
  };
3883
+ isTTY = (type = "stdout") => {
3884
+ return (type === "stdin" ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
3885
+ };
3894
3886
  }
3895
3887
  });
3896
3888
 
@@ -3971,13 +3963,14 @@ var init_restart = __esm({
3971
3963
  import_node_path5 = __toESM(require("path"));
3972
3964
  import_picocolors4 = __toESM(require("../compiled/picocolors/index.js"));
3973
3965
  init_init();
3966
+ init_helpers();
3974
3967
  init_logger();
3975
3968
  cleaners = [];
3976
3969
  onBeforeRestartServer = (cleaner) => {
3977
3970
  cleaners.push(cleaner);
3978
3971
  };
3979
3972
  clearConsole = () => {
3980
- if (process.stdout.isTTY && !process.env.DEBUG) {
3973
+ if (isTTY() && !process.env.DEBUG) {
3981
3974
  process.stdout.write("\x1B[H\x1B[2J");
3982
3975
  }
3983
3976
  };
@@ -4302,7 +4295,8 @@ var init_config = __esm({
4302
4295
  svg: DEFAULT_DATA_URL_SIZE,
4303
4296
  font: DEFAULT_DATA_URL_SIZE,
4304
4297
  image: DEFAULT_DATA_URL_SIZE,
4305
- media: DEFAULT_DATA_URL_SIZE
4298
+ media: DEFAULT_DATA_URL_SIZE,
4299
+ assets: DEFAULT_DATA_URL_SIZE
4306
4300
  },
4307
4301
  legalComments: "linked",
4308
4302
  injectStyles: false,
@@ -5184,14 +5178,7 @@ function createPluginManager() {
5184
5178
  continue;
5185
5179
  }
5186
5180
  validatePlugin(newPlugin);
5187
- const existPlugin = plugins.find(
5188
- (item) => item.instance.name === newPlugin.name && item.environment === environment
5189
- );
5190
- if (existPlugin) {
5191
- import_rslog.logger.warn(
5192
- `Rsbuild plugin "${newPlugin.name}" registered multiple times.`
5193
- );
5194
- } else if (before) {
5181
+ if (before) {
5195
5182
  const index = plugins.findIndex(
5196
5183
  (item) => item.instance.name === before
5197
5184
  );
@@ -6042,7 +6029,7 @@ async function createContext(options, userConfig, bundlerType) {
6042
6029
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6043
6030
  const cachePath = (0, import_node_path10.join)(rootPath, "node_modules", ".cache");
6044
6031
  return {
6045
- version: "1.0.17",
6032
+ version: "1.0.19",
6046
6033
  rootPath,
6047
6034
  distPath: "",
6048
6035
  cachePath,
@@ -6375,7 +6362,7 @@ var init_configChain = __esm({
6375
6362
  JS_DATA_URI: "js-data-uri",
6376
6363
  /** Rule for ts */
6377
6364
  TS: "ts",
6378
- /** Rule for css */
6365
+ /** Rule for CSS */
6379
6366
  CSS: "css",
6380
6367
  /** Rule for less */
6381
6368
  LESS: "less",
@@ -7025,9 +7012,10 @@ var init_cliShortcuts = __esm({
7025
7012
  "use strict";
7026
7013
  import_node_readline = __toESM(require("readline"));
7027
7014
  import_picocolors10 = __toESM(require("../compiled/picocolors/index.js"));
7015
+ init_helpers();
7028
7016
  init_logger();
7029
7017
  init_restart();
7030
- isCliShortcutsEnabled = (devConfig) => devConfig.cliShortcuts && process.stdin.isTTY && !process.env.CI;
7018
+ isCliShortcutsEnabled = (devConfig) => devConfig.cliShortcuts && isTTY("stdin");
7031
7019
  }
7032
7020
  });
7033
7021
 
@@ -9648,7 +9636,7 @@ async function applyCSSRule({
9648
9636
  config,
9649
9637
  root: context.rootPath
9650
9638
  });
9651
- if (postcssLoaderOptions.postcssOptions?.plugins?.length) {
9639
+ if (typeof postcssLoaderOptions.postcssOptions === "function" || postcssLoaderOptions.postcssOptions?.plugins?.length) {
9652
9640
  importLoaders++;
9653
9641
  rule.use(CHAIN_ID2.USE.POSTCSS).loader(getCompiledPath("postcss-loader")).options(postcssLoaderOptions);
9654
9642
  }
@@ -9672,6 +9660,7 @@ var init_css = __esm({
9672
9660
  import_deepmerge2 = __toESM(require_cjs());
9673
9661
  init_dist2();
9674
9662
  init_constants();
9663
+ init_helpers();
9675
9664
  init_path();
9676
9665
  init_pluginHelper();
9677
9666
  isUseCssExtract = (config, target) => !config.output.injectStyles && target !== "node" && target !== "web-worker";
@@ -9713,35 +9702,57 @@ var init_css = __esm({
9713
9702
  const extraPlugins = [];
9714
9703
  const utils = {
9715
9704
  addPlugins(plugins) {
9716
- if (Array.isArray(plugins)) {
9717
- extraPlugins.push(...plugins);
9718
- } else {
9719
- extraPlugins.push(plugins);
9720
- }
9705
+ extraPlugins.push(...castArray(plugins));
9721
9706
  }
9722
9707
  };
9723
- const userPostcssConfig = await loadUserPostcssrc(root);
9724
- userPostcssConfig.plugins ||= [];
9725
- const defaultPostcssConfig = {
9708
+ const userOptions = await loadUserPostcssrc(root);
9709
+ userOptions.plugins ||= [];
9710
+ const defaultOptions2 = {
9726
9711
  implementation: getCompiledPath("postcss"),
9727
- postcssOptions: userPostcssConfig,
9712
+ postcssOptions: userOptions,
9728
9713
  sourceMap: config.output.sourceMap.css
9729
9714
  };
9730
- const merged = reduceConfigsWithContext({
9731
- initial: defaultPostcssConfig,
9715
+ const finalOptions = reduceConfigsWithContext({
9716
+ initial: defaultOptions2,
9732
9717
  config: config.tools.postcss,
9733
9718
  ctx: utils
9734
9719
  });
9735
- merged.postcssOptions ||= {};
9736
- merged.postcssOptions.plugins ||= [];
9737
- if (extraPlugins.length) {
9738
- merged.postcssOptions.plugins.push(...extraPlugins);
9720
+ finalOptions.postcssOptions ||= {};
9721
+ const updatePostcssOptions = (options) => {
9722
+ options.plugins ||= [];
9723
+ if (extraPlugins.length) {
9724
+ options.plugins.push(...extraPlugins);
9725
+ }
9726
+ options.plugins = options.plugins.map(
9727
+ (plugin) => isPostcssPluginCreator(plugin) ? plugin() : plugin
9728
+ );
9729
+ options.config = false;
9730
+ return options;
9731
+ };
9732
+ const { postcssOptions } = finalOptions;
9733
+ if (typeof postcssOptions === "function") {
9734
+ const postcssOptionsWrapper = (loaderContext) => {
9735
+ const options = postcssOptions(loaderContext);
9736
+ if (typeof options !== "object" || options === null) {
9737
+ throw new Error(
9738
+ `\`postcssOptions\` function must return a PostCSSOptions object, got "${typeof options}".`
9739
+ );
9740
+ }
9741
+ const mergedOptions = {
9742
+ ...userOptions,
9743
+ ...options,
9744
+ plugins: [...userOptions.plugins || [], ...options.plugins || []]
9745
+ };
9746
+ return updatePostcssOptions(mergedOptions);
9747
+ };
9748
+ postcssOptionsWrapper.config = false;
9749
+ return {
9750
+ ...finalOptions,
9751
+ postcssOptions: postcssOptionsWrapper
9752
+ };
9739
9753
  }
9740
- merged.postcssOptions.plugins = merged.postcssOptions.plugins.map(
9741
- (plugin) => isPostcssPluginCreator(plugin) ? plugin() : plugin
9742
- );
9743
- merged.postcssOptions.config = false;
9744
- return merged;
9754
+ finalOptions.postcssOptions = updatePostcssOptions(postcssOptions);
9755
+ return finalOptions;
9745
9756
  };
9746
9757
  getCSSLoaderOptions = ({
9747
9758
  config,
@@ -10374,6 +10385,19 @@ var init_asset = __esm({
10374
10385
  if (!emitAssets) {
10375
10386
  chain.module.generator.merge({ "asset/resource": { emit: false } });
10376
10387
  }
10388
+ const { assetsInclude } = config.source;
10389
+ if (assetsInclude) {
10390
+ const { dataUriLimit } = config.output;
10391
+ const rule = chain.module.rule("additional-assets").test(assetsInclude);
10392
+ const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.assets;
10393
+ chainStaticAssetRule({
10394
+ emit: emitAssets,
10395
+ rule,
10396
+ maxSize,
10397
+ filename: assetsFilename,
10398
+ assetType: "additional"
10399
+ });
10400
+ }
10377
10401
  });
10378
10402
  }
10379
10403
  });
@@ -11370,7 +11394,11 @@ function getDefaultSwcConfig(browserslist, cacheRoot) {
11370
11394
  decorators: true
11371
11395
  },
11372
11396
  experimental: {
11373
- cacheRoot
11397
+ cacheRoot,
11398
+ /**
11399
+ * Preserve `with` in imports and exports.
11400
+ */
11401
+ keepImportAttributes: true
11374
11402
  }
11375
11403
  },
11376
11404
  isModule: "unknown",
@@ -12891,7 +12919,7 @@ var sri_exports = {};
12891
12919
  __export(sri_exports, {
12892
12920
  pluginSri: () => pluginSri
12893
12921
  });
12894
- var import_node_crypto2, getAssetName, pluginSri;
12922
+ var import_node_crypto2, getAssetName, isSriLinkRel, pluginSri;
12895
12923
  var init_sri = __esm({
12896
12924
  "src/plugins/sri.ts"() {
12897
12925
  "use strict";
@@ -12905,6 +12933,9 @@ var init_sri = __esm({
12905
12933
  }
12906
12934
  return removeLeadingSlash(url2);
12907
12935
  };
12936
+ isSriLinkRel = (rel) => {
12937
+ return typeof rel === "string" && ["stylesheet", "preload", "modulepreload"].includes(rel);
12938
+ };
12908
12939
  pluginSri = () => ({
12909
12940
  name: "rsbuild:sri",
12910
12941
  setup(api) {
@@ -12935,7 +12966,7 @@ var init_sri = __esm({
12935
12966
  }
12936
12967
  if (tag.tag === "script" && typeof tag.attrs.src === "string") {
12937
12968
  url2 = tag.attrs.src;
12938
- } else if (tag.tag === "link" && tag.attrs.rel === "stylesheet" && typeof tag.attrs.href === "string") {
12969
+ } else if (tag.tag === "link" && isSriLinkRel(tag.attrs.rel) && typeof tag.attrs.href === "string") {
12939
12970
  url2 = tag.attrs.href;
12940
12971
  }
12941
12972
  if (!url2) {
@@ -13609,7 +13640,7 @@ var init_init = __esm({
13609
13640
 
13610
13641
  // src/cli/commands.ts
13611
13642
  function runCli() {
13612
- program.name("rsbuild").usage("<command> [options]").version("1.0.17");
13643
+ program.name("rsbuild").usage("<command> [options]").version("1.0.19");
13613
13644
  const devCommand = program.command("dev");
13614
13645
  const buildCommand = program.command("build");
13615
13646
  const previewCommand = program.command("preview");
@@ -13718,7 +13749,7 @@ function prepareCli() {
13718
13749
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13719
13750
  console.log();
13720
13751
  }
13721
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.17"}`}
13752
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.19"}`}
13722
13753
  `);
13723
13754
  }
13724
13755
  var import_node_module;
@@ -13747,6 +13778,7 @@ __export(internal_exports, {
13747
13778
  initHooks: () => initHooks,
13748
13779
  initPlugins: () => initPlugins,
13749
13780
  initRsbuildConfig: () => initRsbuildConfig,
13781
+ isPlainObject: () => isPlainObject,
13750
13782
  modifyBundlerChain: () => modifyBundlerChain,
13751
13783
  onCompileDone: () => onCompileDone,
13752
13784
  outputInspectConfigFiles: () => outputInspectConfigFiles,
@@ -13804,7 +13836,7 @@ init_logger();
13804
13836
  init_mergeConfig();
13805
13837
  init_helpers();
13806
13838
  init_constants();
13807
- var version = "1.0.17";
13839
+ var version = "1.0.19";
13808
13840
  // Annotate the CommonJS export names for ESM import in node:
13809
13841
  0 && (module.exports = {
13810
13842
  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.4_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js
49
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.60.5_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.4_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
54
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.60.5_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());
@@ -3773,7 +3773,7 @@ function pick(obj, keys) {
3773
3773
  {}
3774
3774
  );
3775
3775
  }
3776
- var import_deepmerge, rspackMinVersion, getNodeEnv, setNodeEnv, isFunction, isObject, isPlainObject, castArray, cloneDeep, compareSemver, isSatisfyRspackVersion, removeLeadingSlash, removeTailingSlash, addTrailingSlash, formatPublicPath, getPublicPathFromChain, getPublicPathFromCompiler, urlJoin, canParse, ensureAssetPrefix, applyToCompiler, upperFirst, isURL, createVirtualModule, isMultiCompiler, camelCase, prettyTime;
3776
+ var import_deepmerge, rspackMinVersion, getNodeEnv, setNodeEnv, isFunction, isObject, isPlainObject, castArray, cloneDeep, compareSemver, isSatisfyRspackVersion, removeLeadingSlash, removeTailingSlash, addTrailingSlash, formatPublicPath, getPublicPathFromChain, getPublicPathFromCompiler, urlJoin, canParse, ensureAssetPrefix, applyToCompiler, upperFirst, isURL, createVirtualModule, isMultiCompiler, camelCase, prettyTime, isTTY;
3777
3777
  var init_helpers = __esm({
3778
3778
  "src/helpers/index.ts"() {
3779
3779
  "use strict";
@@ -3790,19 +3790,8 @@ var init_helpers = __esm({
3790
3790
  };
3791
3791
  isFunction = (func) => typeof func === "function";
3792
3792
  isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
3793
- isPlainObject = (o) => {
3794
- if (isObject(o) === false)
3795
- return false;
3796
- const ctor = o.constructor;
3797
- if (ctor === void 0)
3798
- return true;
3799
- const prot = ctor.prototype;
3800
- if (isObject(prot) === false)
3801
- return false;
3802
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
3803
- return false;
3804
- }
3805
- return true;
3793
+ isPlainObject = (obj) => {
3794
+ return obj !== null && typeof obj === "object" && Object.getPrototypeOf(obj) === Object.prototype;
3806
3795
  };
3807
3796
  castArray = (arr) => {
3808
3797
  if (arr === void 0) {
@@ -3929,6 +3918,9 @@ var init_helpers = __esm({
3929
3918
  const minutes = seconds / 60;
3930
3919
  return `${format(minutes.toFixed(2))} m`;
3931
3920
  };
3921
+ isTTY = (type = "stdout") => {
3922
+ return (type === "stdin" ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
3923
+ };
3932
3924
  }
3933
3925
  });
3934
3926
 
@@ -4011,13 +4003,14 @@ var init_restart = __esm({
4011
4003
  "use strict";
4012
4004
  init_esm();
4013
4005
  init_init();
4006
+ init_helpers();
4014
4007
  init_logger();
4015
4008
  cleaners = [];
4016
4009
  onBeforeRestartServer = (cleaner) => {
4017
4010
  cleaners.push(cleaner);
4018
4011
  };
4019
4012
  clearConsole = () => {
4020
- if (process.stdout.isTTY && !process.env.DEBUG) {
4013
+ if (isTTY() && !process.env.DEBUG) {
4021
4014
  process.stdout.write("\x1B[H\x1B[2J");
4022
4015
  }
4023
4016
  };
@@ -4343,7 +4336,8 @@ var init_config = __esm({
4343
4336
  svg: DEFAULT_DATA_URL_SIZE,
4344
4337
  font: DEFAULT_DATA_URL_SIZE,
4345
4338
  image: DEFAULT_DATA_URL_SIZE,
4346
- media: DEFAULT_DATA_URL_SIZE
4339
+ media: DEFAULT_DATA_URL_SIZE,
4340
+ assets: DEFAULT_DATA_URL_SIZE
4347
4341
  },
4348
4342
  legalComments: "linked",
4349
4343
  injectStyles: false,
@@ -5230,14 +5224,7 @@ function createPluginManager() {
5230
5224
  continue;
5231
5225
  }
5232
5226
  validatePlugin(newPlugin);
5233
- const existPlugin = plugins.find(
5234
- (item) => item.instance.name === newPlugin.name && item.environment === environment
5235
- );
5236
- if (existPlugin) {
5237
- logger.warn(
5238
- `Rsbuild plugin "${newPlugin.name}" registered multiple times.`
5239
- );
5240
- } else if (before) {
5227
+ if (before) {
5241
5228
  const index = plugins.findIndex(
5242
5229
  (item) => item.instance.name === before
5243
5230
  );
@@ -6091,7 +6078,7 @@ async function createContext(options, userConfig, bundlerType) {
6091
6078
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6092
6079
  const cachePath = join6(rootPath, "node_modules", ".cache");
6093
6080
  return {
6094
- version: "1.0.17",
6081
+ version: "1.0.19",
6095
6082
  rootPath,
6096
6083
  distPath: "",
6097
6084
  cachePath,
@@ -6428,7 +6415,7 @@ var init_configChain = __esm({
6428
6415
  JS_DATA_URI: "js-data-uri",
6429
6416
  /** Rule for ts */
6430
6417
  TS: "ts",
6431
- /** Rule for css */
6418
+ /** Rule for CSS */
6432
6419
  CSS: "css",
6433
6420
  /** Rule for less */
6434
6421
  LESS: "less",
@@ -7080,9 +7067,10 @@ var init_cliShortcuts = __esm({
7080
7067
  "src/server/cliShortcuts.ts"() {
7081
7068
  "use strict";
7082
7069
  init_esm();
7070
+ init_helpers();
7083
7071
  init_logger();
7084
7072
  init_restart();
7085
- isCliShortcutsEnabled = (devConfig) => devConfig.cliShortcuts && process.stdin.isTTY && !process.env.CI;
7073
+ isCliShortcutsEnabled = (devConfig) => devConfig.cliShortcuts && isTTY("stdin");
7086
7074
  }
7087
7075
  });
7088
7076
 
@@ -9729,7 +9717,7 @@ async function applyCSSRule({
9729
9717
  config,
9730
9718
  root: context.rootPath
9731
9719
  });
9732
- if (postcssLoaderOptions.postcssOptions?.plugins?.length) {
9720
+ if (typeof postcssLoaderOptions.postcssOptions === "function" || postcssLoaderOptions.postcssOptions?.plugins?.length) {
9733
9721
  importLoaders++;
9734
9722
  rule.use(CHAIN_ID2.USE.POSTCSS).loader(getCompiledPath("postcss-loader")).options(postcssLoaderOptions);
9735
9723
  }
@@ -9753,6 +9741,7 @@ var init_css = __esm({
9753
9741
  import_deepmerge2 = __toESM(require_cjs());
9754
9742
  init_dist2();
9755
9743
  init_constants();
9744
+ init_helpers();
9756
9745
  init_path();
9757
9746
  init_pluginHelper();
9758
9747
  isUseCssExtract = (config, target) => !config.output.injectStyles && target !== "node" && target !== "web-worker";
@@ -9794,35 +9783,57 @@ var init_css = __esm({
9794
9783
  const extraPlugins = [];
9795
9784
  const utils = {
9796
9785
  addPlugins(plugins) {
9797
- if (Array.isArray(plugins)) {
9798
- extraPlugins.push(...plugins);
9799
- } else {
9800
- extraPlugins.push(plugins);
9801
- }
9786
+ extraPlugins.push(...castArray(plugins));
9802
9787
  }
9803
9788
  };
9804
- const userPostcssConfig = await loadUserPostcssrc(root);
9805
- userPostcssConfig.plugins ||= [];
9806
- const defaultPostcssConfig = {
9789
+ const userOptions = await loadUserPostcssrc(root);
9790
+ userOptions.plugins ||= [];
9791
+ const defaultOptions2 = {
9807
9792
  implementation: getCompiledPath("postcss"),
9808
- postcssOptions: userPostcssConfig,
9793
+ postcssOptions: userOptions,
9809
9794
  sourceMap: config.output.sourceMap.css
9810
9795
  };
9811
- const merged = reduceConfigsWithContext({
9812
- initial: defaultPostcssConfig,
9796
+ const finalOptions = reduceConfigsWithContext({
9797
+ initial: defaultOptions2,
9813
9798
  config: config.tools.postcss,
9814
9799
  ctx: utils
9815
9800
  });
9816
- merged.postcssOptions ||= {};
9817
- merged.postcssOptions.plugins ||= [];
9818
- if (extraPlugins.length) {
9819
- merged.postcssOptions.plugins.push(...extraPlugins);
9801
+ finalOptions.postcssOptions ||= {};
9802
+ const updatePostcssOptions = (options) => {
9803
+ options.plugins ||= [];
9804
+ if (extraPlugins.length) {
9805
+ options.plugins.push(...extraPlugins);
9806
+ }
9807
+ options.plugins = options.plugins.map(
9808
+ (plugin) => isPostcssPluginCreator(plugin) ? plugin() : plugin
9809
+ );
9810
+ options.config = false;
9811
+ return options;
9812
+ };
9813
+ const { postcssOptions } = finalOptions;
9814
+ if (typeof postcssOptions === "function") {
9815
+ const postcssOptionsWrapper = (loaderContext) => {
9816
+ const options = postcssOptions(loaderContext);
9817
+ if (typeof options !== "object" || options === null) {
9818
+ throw new Error(
9819
+ `\`postcssOptions\` function must return a PostCSSOptions object, got "${typeof options}".`
9820
+ );
9821
+ }
9822
+ const mergedOptions = {
9823
+ ...userOptions,
9824
+ ...options,
9825
+ plugins: [...userOptions.plugins || [], ...options.plugins || []]
9826
+ };
9827
+ return updatePostcssOptions(mergedOptions);
9828
+ };
9829
+ postcssOptionsWrapper.config = false;
9830
+ return {
9831
+ ...finalOptions,
9832
+ postcssOptions: postcssOptionsWrapper
9833
+ };
9820
9834
  }
9821
- merged.postcssOptions.plugins = merged.postcssOptions.plugins.map(
9822
- (plugin) => isPostcssPluginCreator(plugin) ? plugin() : plugin
9823
- );
9824
- merged.postcssOptions.config = false;
9825
- return merged;
9835
+ finalOptions.postcssOptions = updatePostcssOptions(postcssOptions);
9836
+ return finalOptions;
9826
9837
  };
9827
9838
  getCSSLoaderOptions = ({
9828
9839
  config,
@@ -10460,6 +10471,19 @@ var init_asset = __esm({
10460
10471
  if (!emitAssets) {
10461
10472
  chain.module.generator.merge({ "asset/resource": { emit: false } });
10462
10473
  }
10474
+ const { assetsInclude } = config.source;
10475
+ if (assetsInclude) {
10476
+ const { dataUriLimit } = config.output;
10477
+ const rule = chain.module.rule("additional-assets").test(assetsInclude);
10478
+ const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.assets;
10479
+ chainStaticAssetRule({
10480
+ emit: emitAssets,
10481
+ rule,
10482
+ maxSize,
10483
+ filename: assetsFilename,
10484
+ assetType: "additional"
10485
+ });
10486
+ }
10463
10487
  });
10464
10488
  }
10465
10489
  });
@@ -11467,7 +11491,11 @@ function getDefaultSwcConfig(browserslist, cacheRoot) {
11467
11491
  decorators: true
11468
11492
  },
11469
11493
  experimental: {
11470
- cacheRoot
11494
+ cacheRoot,
11495
+ /**
11496
+ * Preserve `with` in imports and exports.
11497
+ */
11498
+ keepImportAttributes: true
11471
11499
  }
11472
11500
  },
11473
11501
  isModule: "unknown",
@@ -13005,7 +13033,7 @@ __export(sri_exports, {
13005
13033
  pluginSri: () => pluginSri
13006
13034
  });
13007
13035
  import crypto2 from "crypto";
13008
- var getAssetName, pluginSri;
13036
+ var getAssetName, isSriLinkRel, pluginSri;
13009
13037
  var init_sri = __esm({
13010
13038
  "src/plugins/sri.ts"() {
13011
13039
  "use strict";
@@ -13019,6 +13047,9 @@ var init_sri = __esm({
13019
13047
  }
13020
13048
  return removeLeadingSlash(url2);
13021
13049
  };
13050
+ isSriLinkRel = (rel) => {
13051
+ return typeof rel === "string" && ["stylesheet", "preload", "modulepreload"].includes(rel);
13052
+ };
13022
13053
  pluginSri = () => ({
13023
13054
  name: "rsbuild:sri",
13024
13055
  setup(api) {
@@ -13049,7 +13080,7 @@ var init_sri = __esm({
13049
13080
  }
13050
13081
  if (tag.tag === "script" && typeof tag.attrs.src === "string") {
13051
13082
  url2 = tag.attrs.src;
13052
- } else if (tag.tag === "link" && tag.attrs.rel === "stylesheet" && typeof tag.attrs.href === "string") {
13083
+ } else if (tag.tag === "link" && isSriLinkRel(tag.attrs.rel) && typeof tag.attrs.href === "string") {
13053
13084
  url2 = tag.attrs.href;
13054
13085
  }
13055
13086
  if (!url2) {
@@ -13727,7 +13758,7 @@ var init_init = __esm({
13727
13758
 
13728
13759
  // src/cli/commands.ts
13729
13760
  function runCli() {
13730
- program.name("rsbuild").usage("<command> [options]").version("1.0.17");
13761
+ program.name("rsbuild").usage("<command> [options]").version("1.0.19");
13731
13762
  const devCommand = program.command("dev");
13732
13763
  const buildCommand = program.command("build");
13733
13764
  const previewCommand = program.command("preview");
@@ -13838,7 +13869,7 @@ function prepareCli() {
13838
13869
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13839
13870
  console.log();
13840
13871
  }
13841
- logger.greet(` ${`Rsbuild v${"1.0.17"}`}
13872
+ logger.greet(` ${`Rsbuild v${"1.0.19"}`}
13842
13873
  `);
13843
13874
  }
13844
13875
  var init_prepare = __esm({
@@ -13866,6 +13897,7 @@ __export(internal_exports, {
13866
13897
  initHooks: () => initHooks,
13867
13898
  initPlugins: () => initPlugins,
13868
13899
  initRsbuildConfig: () => initRsbuildConfig,
13900
+ isPlainObject: () => isPlainObject,
13869
13901
  modifyBundlerChain: () => modifyBundlerChain,
13870
13902
  onCompileDone: () => onCompileDone,
13871
13903
  outputInspectConfigFiles: () => outputInspectConfigFiles,
@@ -13909,7 +13941,7 @@ init_mergeConfig();
13909
13941
  init_helpers();
13910
13942
  init_constants();
13911
13943
  import { rspack as rspack10 } from "@rspack/core";
13912
- var version = "1.0.17";
13944
+ var version = "1.0.19";
13913
13945
  export {
13914
13946
  PLUGIN_CSS_NAME,
13915
13947
  PLUGIN_SWC_NAME,
@@ -20,7 +20,7 @@ export declare const CHAIN_ID: {
20
20
  readonly JS_DATA_URI: "js-data-uri";
21
21
  /** Rule for ts */
22
22
  readonly TS: "ts";
23
- /** Rule for css */
23
+ /** Rule for CSS */
24
24
  readonly CSS: "css";
25
25
  /** Rule for less */
26
26
  readonly LESS: "less";
@@ -10,7 +10,7 @@ export declare const setNodeEnv: (env: string) => void;
10
10
  export declare const isNil: (o: unknown) => o is undefined | null;
11
11
  export declare const isFunction: (func: unknown) => func is (...args: any[]) => any;
12
12
  export declare const isObject: (obj: unknown) => obj is Record<string, any>;
13
- export declare const isPlainObject: (o: unknown) => o is Record<string, any>;
13
+ export declare const isPlainObject: (obj: unknown) => obj is Record<string, any>;
14
14
  export declare const castArray: <T>(arr?: T | T[]) => T[];
15
15
  export declare const cloneDeep: <T>(value: T) => T;
16
16
  export declare const isSatisfyRspackVersion: (originalVersion: string) => Promise<boolean>;
@@ -37,3 +37,7 @@ export declare const isMultiCompiler: <C extends Rspack.Compiler | WebpackCompil
37
37
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Pick<T, U>;
38
38
  export declare const camelCase: (input: string) => string;
39
39
  export declare const prettyTime: (seconds: number) => string;
40
+ /**
41
+ * Check if running in a TTY context
42
+ */
43
+ export declare const isTTY: (type?: "stdin" | "stdout") => boolean;
@@ -11,7 +11,7 @@ export { initRsbuildConfig } from './provider/initConfigs';
11
11
  export { stringifyConfig, getRsbuildInspectConfig, outputInspectConfigFiles, } from './config';
12
12
  export type { InternalContext } from './types';
13
13
  export { setHTMLPlugin, getHTMLPlugin } from './pluginHelper';
14
- export { formatStats, getStatsOptions, prettyTime } from './helpers';
14
+ export { formatStats, getStatsOptions, prettyTime, isPlainObject, } from './helpers';
15
15
  export { registerBuildHook, registerDevHook, onCompileDone } from './hooks';
16
16
  export { getChainUtils, getConfigUtils } from './provider/rspackConfig';
17
17
  export { chainToConfig, modifyBundlerChain } from './configChain';
@@ -1,7 +1,7 @@
1
1
  import type { SwcLoaderOptions } from '@rspack/core';
2
2
  import type { NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
3
3
  /**
4
- * Provide some swc configs of rspack
4
+ * Provide some SWC configs of Rspack
5
5
  */
6
6
  export declare const pluginSwc: () => RsbuildPlugin;
7
7
  export declare function applySwcDecoratorConfig(swcConfig: SwcLoaderOptions, config: NormalizedEnvironmentConfig): void;
@@ -9,7 +9,7 @@ export type MiddlewareCallbacks = {
9
9
  onDone: (stats: any) => void;
10
10
  };
11
11
  export type DevMiddlewareOptions = {
12
- /** To ensure HMR works, the devMiddleware need inject the hmr client path into page when HMR enable. */
12
+ /** To ensure HMR works, the devMiddleware need inject the HMR client path into page when HMR enable. */
13
13
  clientPaths?: string[];
14
14
  clientConfig: DevConfig['client'];
15
15
  publicPath?: string;
@@ -19,7 +19,7 @@ export type DevMiddlewareAPI = Middleware & {
19
19
  /**
20
20
  * The rsbuild/server do nothing about compiler, the devMiddleware need do such things to ensure dev works well:
21
21
  * - Call compiler.watch (normally did by rsbuild-dev-middleware).
22
- * - Inject the hmr client path into page (the hmr client rsbuild/server already provide).
22
+ * - Inject the HMR client path into page (the HMR client rsbuild/server already provide).
23
23
  * - Notify server when compiler hooks are triggered.
24
24
  */
25
25
  export type DevMiddleware = (options: DevMiddlewareOptions) => DevMiddlewareAPI;
@@ -107,6 +107,11 @@ export interface SourceConfig {
107
107
  * and the `alias` option in the bundler.
108
108
  */
109
109
  aliasStrategy?: AliasStrategy;
110
+ /**
111
+ * Include additional files that should be treated as static assets.
112
+ * @default undefined
113
+ */
114
+ assetsInclude?: Rspack.RuleSetCondition;
110
115
  /**
111
116
  * Specify directories or modules that need additional compilation.
112
117
  * In order to maintain faster compilation speed, Rsbuild will not compile files under node_modules through
@@ -529,47 +534,78 @@ export type FilenameConfig = {
529
534
  assets?: string;
530
535
  };
531
536
  export type DataUriLimit = {
532
- /** The data URI limit of the SVG image. */
537
+ /**
538
+ * The data URI limit of the SVG image.
539
+ * @default 4096
540
+ */
533
541
  svg?: number;
534
- /** The data URI limit of the font file. */
542
+ /**
543
+ * The data URI limit of the font file.
544
+ * @default 4096
545
+ */
535
546
  font?: number;
536
- /** The data URI limit of non-SVG images. */
547
+ /**
548
+ * The data URI limit of non-SVG images.
549
+ * @default 4096
550
+ */
537
551
  image?: number;
538
- /** The data URI limit of media resources such as videos. */
552
+ /**
553
+ * The data URI limit of media resources such as videos.
554
+ * @default 4096
555
+ */
539
556
  media?: number;
557
+ /**
558
+ * The data URI limit of other static assets.
559
+ * @default 4096
560
+ */
561
+ assets?: number;
540
562
  };
541
563
  export type Charset = 'ascii' | 'utf8';
542
564
  export type LegalComments = 'none' | 'inline' | 'linked';
543
565
  export type NormalizedDataUriLimit = Required<DataUriLimit>;
544
566
  export type Polyfill = 'usage' | 'entry' | 'off';
545
567
  export type SourceMap = {
568
+ /**
569
+ * The source map type for JavaScript files.
570
+ * @default isDev ? 'cheap-module-source-map' : false
571
+ */
546
572
  js?: Rspack.Configuration['devtool'];
573
+ /**
574
+ * Whether to generate source map for CSS files.
575
+ * @default false
576
+ */
547
577
  css?: boolean;
548
578
  };
549
579
  export type CSSModulesLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
550
580
  export type CSSModules = {
551
581
  /**
552
582
  * Allows CSS Modules to be automatically enabled based on their filenames.
583
+ * @default true
553
584
  */
554
585
  auto?: CSSLoaderModulesOptions['auto'];
555
586
  /**
556
587
  * Allows exporting names from global class names, so you can use them via import.
588
+ * @default false
557
589
  */
558
590
  exportGlobals?: boolean;
559
591
  /**
560
592
  * Style of exported class names.
593
+ * @default 'camelCase'
561
594
  */
562
595
  exportLocalsConvention?: CSSModulesLocalsConvention;
563
596
  /**
564
597
  * Set the local ident name of CSS Modules.
598
+ * @default isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'
565
599
  */
566
600
  localIdentName?: string;
567
601
  /**
568
602
  * Controls the level of compilation applied to the input styles.
603
+ * @default 'local'
569
604
  */
570
605
  mode?: CSSLoaderModulesOptions['mode'];
571
606
  /**
572
607
  * Whether to enable ES modules named export for locals.
608
+ * @default false
573
609
  */
574
610
  namedExport?: boolean;
575
611
  };
@@ -609,6 +645,7 @@ export interface OutputConfig {
609
645
  /**
610
646
  * At build time, prevent some `import` dependencies from being packed into bundles in your code, and instead fetch them externally at runtime.
611
647
  * For more information, please see: [Rspack Externals](https://rspack.dev/config/externals)
648
+ * @default undefined
612
649
  */
613
650
  externals?: Externals;
614
651
  /**
@@ -628,12 +665,14 @@ export interface OutputConfig {
628
665
  charset?: Charset;
629
666
  /**
630
667
  * Configure how the polyfill is injected.
668
+ * @default 'off'
631
669
  */
632
670
  polyfill?: Polyfill;
633
671
  /**
634
672
  * When using CDN in the production,
635
673
  * you can use this option to set the URL prefix of static assets,
636
674
  * similar to the output.publicPath config of webpack.
675
+ * @default `server.base`
637
676
  */
638
677
  assetPrefix?: string;
639
678
  /**
@@ -647,6 +686,7 @@ export interface OutputConfig {
647
686
  * comment in CSS that contains @license or @preserve or that starts with //! or /\*!.
648
687
  * These comments are preserved in output files by default since that follows the intent
649
688
  * of the original authors of the code.
689
+ * @default 'linked'
650
690
  */
651
691
  legalComments?: LegalComments;
652
692
  /**
@@ -660,30 +700,44 @@ export interface OutputConfig {
660
700
  cssModules?: CSSModules;
661
701
  /**
662
702
  * Whether to disable code minification in production build.
703
+ * @default true
663
704
  */
664
705
  minify?: Minify;
665
706
  /**
666
707
  * Whether to generate manifest file.
708
+ * @default false
667
709
  */
668
710
  manifest?: string | boolean;
669
711
  /**
670
- * Whether to generate source map files, and which format of source map to generate
712
+ * Whether to generate source map files, and which format of source map to generate.
713
+ *
714
+ * @default
715
+ * ```js
716
+ * const defaultSourceMap = {
717
+ * js: isDev ? 'cheap-module-source-map' : false,
718
+ * css: false,
719
+ * };
720
+ * ```
671
721
  */
672
722
  sourceMap?: SourceMap;
673
723
  /**
674
724
  * Whether to add filename hash after production build.
725
+ * @default true
675
726
  */
676
727
  filenameHash?: boolean | string;
677
728
  /**
678
729
  * Whether to inline output scripts files (.js files) into HTML with `<script>` tags.
730
+ * @default false
679
731
  */
680
732
  inlineScripts?: InlineChunkConfig;
681
733
  /**
682
734
  * Whether to inline output style files (.css files) into html with `<style>` tags.
735
+ * @default false
683
736
  */
684
737
  inlineStyles?: InlineChunkConfig;
685
738
  /**
686
739
  * Whether to inject styles into the DOM via `style-loader`.
740
+ * @default false
687
741
  */
688
742
  injectStyles?: boolean;
689
743
  /**
@@ -691,26 +745,25 @@ export interface OutputConfig {
691
745
  * This value will be used by [SWC](https://github.com/swc-project/swc) and
692
746
  * [Lightning CSS](https://github.com/parcel-bundler/lightningcss) to identify the JavaScript syntax that
693
747
  * need to be transformed and the CSS browser prefixes that need to be added.
748
+ * @default undefined
694
749
  */
695
750
  overrideBrowserslist?: string[];
696
751
  /**
697
752
  * Copies the specified file or directory to the dist directory.
753
+ * @default undefined
698
754
  */
699
755
  copy?: CopyRspackPluginOptions | CopyRspackPluginOptions['patterns'];
700
756
  /**
701
757
  * Whether to emit static assets such as image, font, etc.
702
758
  * Return `false` to avoid outputting unnecessary assets for some scenarios such as SSR.
759
+ * @default true
703
760
  */
704
761
  emitAssets?: boolean;
705
762
  }
706
763
  export interface NormalizedOutputConfig extends OutputConfig {
707
764
  target: RsbuildTarget;
708
765
  filename: FilenameConfig;
709
- distPath: Omit<Required<DistPathConfig>, 'jsAsync' | 'cssAsync' | 'js'> & {
710
- js?: string;
711
- jsAsync?: string;
712
- cssAsync?: string;
713
- };
766
+ distPath: Omit<Required<DistPathConfig>, 'jsAsync' | 'cssAsync' | 'js'> & Pick<DistPathConfig, 'jsAsync' | 'cssAsync' | 'js'>;
714
767
  polyfill: Polyfill;
715
768
  sourceMap: {
716
769
  js?: Rspack.Configuration['devtool'];
@@ -809,27 +862,40 @@ export type AppIcon = {
809
862
  export interface HtmlConfig {
810
863
  /**
811
864
  * Configure the `<meta>` tag of the HTML.
865
+ *
866
+ * @default
867
+ * ```js
868
+ * const defaultMeta = {
869
+ * charset: { charset: 'UTF-8' },
870
+ * viewport: 'width=device-width, initial-scale=1.0',
871
+ * };
872
+ * ```
812
873
  */
813
874
  meta?: ChainedHtmlOption<MetaOptions>;
814
875
  /**
815
876
  * Set the title tag of the HTML page.
877
+ * @default 'Rsbuild App'
816
878
  */
817
879
  title?: ChainedHtmlOption<string>;
818
880
  /**
819
881
  * Set the inject position of the `<script>` tag.
882
+ * @default 'head'
820
883
  */
821
884
  inject?: ChainedHtmlOption<ScriptInject>;
822
885
  /**
823
886
  * Inject custom html tags into the output html files.
887
+ * @default undefined
824
888
  */
825
889
  tags?: OneOrMany<HtmlTagDescriptor>;
826
890
  /**
827
891
  * Set the favicon icon for all pages.
892
+ * @default undefined
828
893
  */
829
894
  favicon?: ChainedHtmlOption<string>;
830
895
  /**
831
896
  * Set the web application icons to display when added to the home screen of a mobile device.
832
897
  *
898
+ * @default undefined
833
899
  * @example
834
900
  * appIcon: {
835
901
  * name: 'My Website',
@@ -842,20 +908,24 @@ export interface HtmlConfig {
842
908
  appIcon?: AppIcon;
843
909
  /**
844
910
  * Set the id of root element.
911
+ * @default 'root'
845
912
  */
846
913
  mountId?: string;
847
914
  /**
848
915
  * Set the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) attribute
849
916
  * of the `<script>` tag.
917
+ * @default false
850
918
  */
851
919
  crossorigin?: boolean | CrossOrigin;
852
920
  /**
853
921
  * Define the directory structure of the HTML output files.
922
+ * @default 'flat'
854
923
  */
855
924
  outputStructure?: OutputStructure;
856
925
  /**
857
926
  * Define the path to the HTML template,
858
927
  * corresponding to the `template` config of [html-rspack-plugin](https://github.com/rspack-contrib/html-rspack-plugin).
928
+ * @default A built-in HTML template
859
929
  */
860
930
  template?: ChainedHtmlOption<string>;
861
931
  /**
@@ -867,6 +937,7 @@ export interface HtmlConfig {
867
937
  }>;
868
938
  /**
869
939
  * Set the loading mode of the `<script>` tag.
940
+ * @default 'defer'
870
941
  */
871
942
  scriptLoading?: ScriptLoading;
872
943
  }
@@ -73,10 +73,12 @@ export type PluginManager = {
73
73
  environment: string;
74
74
  }) => RsbuildPlugin[];
75
75
  addPlugins: (plugins: Array<RsbuildPlugin | Falsy>, options?: {
76
+ /**
77
+ * Insert before the specified plugin.
78
+ */
76
79
  before?: string;
77
80
  /**
78
81
  * Add a plugin for the specified environment.
79
- *
80
82
  * If environment is not specified, it will be registered as a global plugin (effective in all environments)
81
83
  */
82
84
  environment?: string;
@@ -16,27 +16,31 @@ export type PostCSSOptions = ProcessOptions & {
16
16
  export type PostCSSLoaderOptions = {
17
17
  /**
18
18
  * Enable PostCSS Parser support in CSS-in-JS. If you use JS styles the postcss-js parser, add the execute option.
19
+ * @default undefined
19
20
  */
20
21
  execute?: boolean;
21
22
  /**
22
- * By default generation of source maps depends on the devtool option. All values enable source map generation except eval and false value.
23
+ * Whether to generate source maps.
24
+ * @default `rsbuildConfig.output.sourceMap.css`
23
25
  */
24
26
  sourceMap?: boolean;
25
27
  /**
26
28
  * The special implementation option determines which implementation of PostCSS to use.
29
+ * @default `@rsbuild/core/compiled/postcss`
27
30
  */
28
31
  implementation?: unknown;
29
32
  /**
30
33
  * Allows to set PostCSS options and plugins.
34
+ * @default undefined
31
35
  */
32
- postcssOptions?: PostCSSOptions;
36
+ postcssOptions?: PostCSSOptions | ((loaderContext: Rspack.LoaderContext) => PostCSSOptions);
33
37
  };
34
38
  export type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
35
39
  export type CSSLoaderModulesMode = 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: string) => 'local' | 'global' | 'pure' | 'icss');
36
40
  export type CSSLoaderExportLocalsConvention = 'asIs' | 'as-is' | 'camelCase' | 'camel-case' | 'camelCaseOnly' | 'camel-case-only' | 'dashes' | 'dashesOnly' | 'dashes-only' | ((name: string) => string);
37
41
  export interface CSSLoaderModulesOptions {
38
42
  /**
39
- * Allows auto enable CSS modules/ICSS based on the filename, query or fragment.
43
+ * Allows auto enable CSS Modules/ICSS based on the filename, query or fragment.
40
44
  */
41
45
  auto?: boolean | RegExp | ((resourcePath: string, resourceQuery: string, resourceFragment: string) => boolean);
42
46
  /**
@@ -88,7 +92,7 @@ export interface CSSLoaderModulesOptions {
88
92
  */
89
93
  namedExport?: boolean;
90
94
  /**
91
- * Enables a callback to output the CSS modules mapping JSON.
95
+ * Enables a callback to output the CSS Modules mapping JSON.
92
96
  */
93
97
  getJSON?: (context: {
94
98
  resourcePath: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {