@rsbuild/core 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 2562: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 4420: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(7856);
5
+ const loader = __nccwpck_require__(2922);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(5241).defaultGetLocalIdent;
8
+ __nccwpck_require__(9515).defaultGetLocalIdent;
9
9
  },
10
- 7856: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 2922: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
15
- var _plugins = __nccwpck_require__(4655);
16
- var _utils = __nccwpck_require__(5241);
15
+ var _plugins = __nccwpck_require__(6809);
16
+ var _utils = __nccwpck_require__(9515);
17
17
  function _interopRequireDefault(obj) {
18
18
  return obj && obj.__esModule ? obj : { default: obj };
19
19
  }
@@ -236,7 +236,7 @@
236
236
  callback(null, `${importCode}${moduleCode}${exportCode}`);
237
237
  }
238
238
  },
239
- 4655: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 6809: (__unused_webpack_module, exports, __nccwpck_require__) => {
240
240
  "use strict";
241
241
  Object.defineProperty(exports, "__esModule", { value: true });
242
242
  Object.defineProperty(exports, "icssParser", {
@@ -258,22 +258,22 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(3612),
261
+ __nccwpck_require__(8210),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(3321),
264
+ __nccwpck_require__(9691),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9008));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4526));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 3321: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 9691: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
272
  "use strict";
273
273
  Object.defineProperty(exports, "__esModule", { value: true });
274
274
  exports["default"] = void 0;
275
275
  var _icssUtils = __nccwpck_require__(9028);
276
- var _utils = __nccwpck_require__(5241);
276
+ var _utils = __nccwpck_require__(9515);
277
277
  const plugin = (options = {}) => ({
278
278
  postcssPlugin: "postcss-icss-parser",
279
279
  async OnceExit(root) {
@@ -372,14 +372,14 @@
372
372
  plugin.postcss = true;
373
373
  var _default = (exports["default"] = plugin);
374
374
  },
375
- 3612: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 8210: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
376
  "use strict";
377
377
  Object.defineProperty(exports, "__esModule", { value: true });
378
378
  exports["default"] = void 0;
379
379
  var _postcssValueParser = _interopRequireDefault(
380
380
  __nccwpck_require__(2948),
381
381
  );
382
- var _utils = __nccwpck_require__(5241);
382
+ var _utils = __nccwpck_require__(9515);
383
383
  function _interopRequireDefault(obj) {
384
384
  return obj && obj.__esModule ? obj : { default: obj };
385
385
  }
@@ -684,14 +684,14 @@
684
684
  plugin.postcss = true;
685
685
  var _default = (exports["default"] = plugin);
686
686
  },
687
- 9008: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 4526: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
688
  "use strict";
689
689
  Object.defineProperty(exports, "__esModule", { value: true });
690
690
  exports["default"] = void 0;
691
691
  var _postcssValueParser = _interopRequireDefault(
692
692
  __nccwpck_require__(2948),
693
693
  );
694
- var _utils = __nccwpck_require__(5241);
694
+ var _utils = __nccwpck_require__(9515);
695
695
  function _interopRequireDefault(obj) {
696
696
  return obj && obj.__esModule ? obj : { default: obj };
697
697
  }
@@ -1034,7 +1034,7 @@
1034
1034
  plugin.postcss = true;
1035
1035
  var _default = (exports["default"] = plugin);
1036
1036
  },
1037
- 5241: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 9515: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1038
  "use strict";
1039
1039
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1040
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -8098,6 +8098,6 @@
8098
8098
  }
8099
8099
  if (typeof __nccwpck_require__ !== "undefined")
8100
8100
  __nccwpck_require__.ab = __dirname + "/";
8101
- var __webpack_exports__ = __nccwpck_require__(2562);
8101
+ var __webpack_exports__ = __nccwpck_require__(4420);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 528: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 29: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(773);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(550);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -311,7 +311,7 @@
311
311
  }
312
312
  module.exports = { CachedChildCompilation };
313
313
  },
314
- 773: (module) => {
314
+ 550: (module) => {
315
315
  "use strict";
316
316
  class HtmlWebpackChildCompiler {
317
317
  constructor(templates) {
@@ -480,7 +480,7 @@
480
480
  }
481
481
  module.exports = { HtmlWebpackChildCompiler };
482
482
  },
483
- 979: (module) => {
483
+ 950: (module) => {
484
484
  "use strict";
485
485
  module.exports = {};
486
486
  module.exports.none = (chunks) => chunks;
@@ -499,7 +499,7 @@
499
499
  };
500
500
  module.exports.auto = module.exports.none;
501
501
  },
502
- 406: (module) => {
502
+ 529: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -520,7 +520,7 @@
520
520
  };
521
521
  };
522
522
  },
523
- 613: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 368: (module, __unused_webpack_exports, __nccwpck_require__) => {
524
524
  "use strict";
525
525
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
526
526
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -546,7 +546,7 @@
546
546
  }
547
547
  module.exports = { getHtmlRspackPluginHooks };
548
548
  },
549
- 476: (module) => {
549
+ 949: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 177: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 568: (module, __unused_webpack_exports, __nccwpck_require__) => {
618
618
  "use strict";
619
619
  const promisify = __nccwpck_require__(23).promisify;
620
620
  const vm = __nccwpck_require__(154);
621
621
  const fs = __nccwpck_require__(896);
622
622
  const path = __nccwpck_require__(928);
623
- const { CachedChildCompilation } = __nccwpck_require__(528);
623
+ const { CachedChildCompilation } = __nccwpck_require__(29);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(476);
626
- const prettyError = __nccwpck_require__(406);
627
- const chunkSorter = __nccwpck_require__(979);
625
+ __nccwpck_require__(949);
626
+ const prettyError = __nccwpck_require__(529);
627
+ const chunkSorter = __nccwpck_require__(950);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(613).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(368).getHtmlRspackPluginHooks;
630
630
  const WITH_PLACEHOLDER = "function __with_placeholder__";
631
631
  class HtmlRspackPlugin {
632
632
  constructor(userOptions = {}) {
@@ -1597,6 +1597,6 @@
1597
1597
  }
1598
1598
  if (typeof __nccwpck_require__ !== "undefined")
1599
1599
  __nccwpck_require__.ab = __dirname + "/";
1600
- var __webpack_exports__ = __nccwpck_require__(177);
1600
+ var __webpack_exports__ = __nccwpck_require__(568);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 414: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(148)["default"];
4
+ 636: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(378)["default"];
6
6
  },
7
- 148: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 378: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(237);
12
+ var _utils = __nccwpck_require__(427);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 237: (module, exports, __nccwpck_require__) => {
182
+ 427: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(414);
719
+ var __webpack_exports__ = __nccwpck_require__(636);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,67 +1,73 @@
1
- type ColorFn = (input: string | number | null | undefined) => string;
2
-
3
- declare let LOG_TYPES: {
4
- error: {
5
- label: string;
6
- level: "error";
7
- color: ColorFn;
8
- };
9
- warn: {
10
- label: string;
11
- level: "warn";
12
- color: ColorFn;
13
- };
14
- info: {
15
- label: string;
16
- level: "info";
17
- color: ColorFn;
18
- };
19
- start: {
20
- label: string;
21
- level: "info";
22
- color: ColorFn;
23
- };
24
- ready: {
25
- label: string;
26
- level: "info";
27
- color: ColorFn;
28
- };
29
- success: {
30
- label: string;
31
- level: "info";
32
- color: ColorFn;
33
- };
34
- log: {
35
- level: "info";
36
- };
37
- debug: {
38
- label: string;
39
- level: "verbose";
40
- color: ColorFn;
41
- };
42
- };
43
-
44
- type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
45
- type LogMessage = unknown;
46
- interface LogType {
47
- label?: string;
48
- level: LogLevel;
49
- color?: ColorFn;
50
- }
51
- type LogFunction = (message?: LogMessage, ...args: any[]) => void;
52
- interface Options {
53
- level?: LogLevel;
1
+ declare type ColorFn = (input: string | number | null | undefined) => string;
2
+
3
+ declare let createLogger: (options?: Options) => Logger;
4
+
5
+ declare let LOG_TYPES: {
6
+ error: {
7
+ label: string;
8
+ level: "error";
9
+ color: ColorFn;
10
+ };
11
+ warn: {
12
+ label: string;
13
+ level: "warn";
14
+ color: ColorFn;
15
+ };
16
+ info: {
17
+ label: string;
18
+ level: "info";
19
+ color: ColorFn;
20
+ };
21
+ start: {
22
+ label: string;
23
+ level: "info";
24
+ color: ColorFn;
25
+ };
26
+ ready: {
27
+ label: string;
28
+ level: "info";
29
+ color: ColorFn;
30
+ };
31
+ success: {
32
+ label: string;
33
+ level: "info";
34
+ color: ColorFn;
35
+ };
36
+ log: {
37
+ level: "info";
38
+ };
39
+ debug: {
40
+ label: string;
41
+ level: "verbose";
42
+ color: ColorFn;
43
+ };
44
+ };
45
+
46
+ declare type LogFunction = (message?: LogMessage, ...args: any[]) => void;
47
+
48
+ declare type Logger = Record<LogMethods, LogFunction> & {
49
+ greet: (message: string) => void;
50
+ level: LogLevel;
51
+ override: (customLogger: Partial<Record<LogMethods, LogFunction>>) => void;
52
+ };
53
+
54
+ declare let logger: Logger;
55
+
56
+ declare type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
57
+
58
+ declare type LogMessage = unknown;
59
+
60
+ declare type LogMethods = keyof typeof LOG_TYPES;
61
+
62
+ declare interface LogType {
63
+ label?: string;
64
+ level: LogLevel;
65
+ color?: ColorFn;
66
+ }
67
+
68
+ declare interface Options {
69
+ level?: LogLevel;
54
70
  }
55
- type LogMethods = keyof typeof LOG_TYPES;
56
- type Logger = Record<LogMethods, LogFunction> & {
57
- greet: (message: string) => void;
58
- level: LogLevel;
59
- override: (customLogger: Partial<Record<LogMethods, LogFunction>>) => void;
60
- };
61
-
62
- declare let createLogger: (options?: Options) => Logger;
63
-
64
- declare let logger: Logger;
65
71
 
66
72
  export { createLogger, logger };
67
73
  export type { LogFunction, LogLevel, LogMessage, LogType, Logger, Options };
@@ -1 +1 @@
1
- {"name":"rslog","version":"1.2.7","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rslog","version":"1.2.8","types":"index.d.ts","type":"commonjs"}
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 776: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 543: (__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
- 121: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 994: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const fs_1 = __nccwpck_require__(896);
131
131
  const path_1 = __nccwpck_require__(928);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(776);
133
+ const helpers_1 = __nccwpck_require__(543);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(928);
315
- const hooks_1 = __nccwpck_require__(121);
315
+ const hooks_1 = __nccwpck_require__(994);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -2247,7 +2247,7 @@ ${section.body}` : section.body).join("\n\n"));
2247
2247
  async function createContext(options, userConfig) {
2248
2248
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2249
2249
  return {
2250
- version: "1.4.0",
2250
+ version: "1.4.1",
2251
2251
  rootPath,
2252
2252
  distPath: '',
2253
2253
  cachePath,
@@ -2294,7 +2294,7 @@ ${section.body}` : section.body).join("\n\n"));
2294
2294
  setup () {}
2295
2295
  };
2296
2296
  };
2297
- async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, configType }) {
2297
+ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, rawExtraConfigs, configType }) {
2298
2298
  let { outputPath } = inspectOptions, files = [
2299
2299
  ...rawEnvironmentConfigs.map(({ name, content })=>{
2300
2300
  if (1 === rawEnvironmentConfigs.length) return {
@@ -2316,7 +2316,12 @@ ${section.body}` : section.body).join("\n\n"));
2316
2316
  label: `${upperFirst(configType)} Config (${name})`,
2317
2317
  content
2318
2318
  };
2319
- })
2319
+ }),
2320
+ ...(rawExtraConfigs || []).map(({ name, content })=>({
2321
+ path: (0, external_node_path_namespaceObject.join)(outputPath, `${name}.config.mjs`),
2322
+ label: `${upperFirst(name)} Config`,
2323
+ content
2324
+ }))
2320
2325
  ];
2321
2326
  await external_node_fs_default().promises.mkdir(outputPath, {
2322
2327
  recursive: !0
@@ -2362,10 +2367,14 @@ ${section.body}` : section.body).join("\n\n"));
2362
2367
  normalizedConfig: context.normalizedConfig,
2363
2368
  inspectOptions,
2364
2369
  pluginManager
2365
- }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions1.outputPath) ? inspectOptions1.outputPath : (0, external_node_path_namespaceObject.join)(context1.distPath, inspectOptions1.outputPath) : (0, external_node_path_namespaceObject.join)(context1.distPath, RSBUILD_OUTPUTS_PATH));
2370
+ }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions1.outputPath) ? inspectOptions1.outputPath : (0, external_node_path_namespaceObject.join)(context1.distPath, inspectOptions1.outputPath) : (0, external_node_path_namespaceObject.join)(context1.distPath, RSBUILD_OUTPUTS_PATH)), rawExtraConfigs = inspectOptions.extraConfigs ? Object.entries(inspectOptions.extraConfigs).map(([name, content])=>({
2371
+ name,
2372
+ content: 'string' == typeof content ? content : stringifyConfig(content, inspectOptions.verbose)
2373
+ })) : void 0;
2366
2374
  return inspectOptions.writeToDisk && await outputInspectConfigFiles({
2367
2375
  rawBundlerConfigs,
2368
2376
  rawEnvironmentConfigs,
2377
+ rawExtraConfigs,
2369
2378
  inspectOptions: {
2370
2379
  ...inspectOptions,
2371
2380
  outputPath
@@ -7519,11 +7528,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7519
7528
  ].includes(level) && (index_js_namespaceObject.logger.level = level);
7520
7529
  }
7521
7530
  let { npm_execpath } = process.env;
7522
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0\n`);
7531
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.1\n`);
7523
7532
  try {
7524
7533
  !function() {
7525
7534
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7526
- cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7535
+ cli.help(), cli.version("1.4.1"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7527
7536
  default: 'jiti'
7528
7537
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7529
7538
  type: [
@@ -7581,7 +7590,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7581
7590
  index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
7582
7591
  }
7583
7592
  }
7584
- let src_version = "1.4.0";
7593
+ let src_version = "1.4.1";
7585
7594
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7586
7595
  "PLUGIN_CSS_NAME",
7587
7596
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -2059,7 +2059,7 @@ async function updateEnvironmentContext(context, configs) {
2059
2059
  async function createContext(options, userConfig) {
2060
2060
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2061
2061
  return {
2062
- version: "1.4.0",
2062
+ version: "1.4.1",
2063
2063
  rootPath,
2064
2064
  distPath: '',
2065
2065
  cachePath,
@@ -2104,7 +2104,7 @@ let normalizePluginObject = (plugin)=>{
2104
2104
  setup () {}
2105
2105
  };
2106
2106
  };
2107
- async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, configType }) {
2107
+ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, rawExtraConfigs, configType }) {
2108
2108
  let { outputPath } = inspectOptions, files = [
2109
2109
  ...rawEnvironmentConfigs.map(({ name, content })=>1 === rawEnvironmentConfigs.length ? {
2110
2110
  path: join(outputPath, 'rsbuild.config.mjs'),
@@ -2122,7 +2122,12 @@ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfi
2122
2122
  label: `${upperFirst(configType)} Config (${name})`,
2123
2123
  content
2124
2124
  };
2125
- })
2125
+ }),
2126
+ ...(rawExtraConfigs || []).map(({ name, content })=>({
2127
+ path: join(outputPath, `${name}.config.mjs`),
2128
+ label: `${upperFirst(name)} Config`,
2129
+ content
2130
+ }))
2126
2131
  ];
2127
2132
  await node_fs.promises.mkdir(outputPath, {
2128
2133
  recursive: !0
@@ -2168,10 +2173,14 @@ async function inspectConfig({ context, pluginManager, bundlerConfigs, inspectOp
2168
2173
  normalizedConfig: context.normalizedConfig,
2169
2174
  inspectOptions,
2170
2175
  pluginManager
2171
- }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? external_node_path_isAbsolute(inspectOptions1.outputPath) ? inspectOptions1.outputPath : join(context1.distPath, inspectOptions1.outputPath) : join(context1.distPath, RSBUILD_OUTPUTS_PATH));
2176
+ }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? external_node_path_isAbsolute(inspectOptions1.outputPath) ? inspectOptions1.outputPath : join(context1.distPath, inspectOptions1.outputPath) : join(context1.distPath, RSBUILD_OUTPUTS_PATH)), rawExtraConfigs = inspectOptions.extraConfigs ? Object.entries(inspectOptions.extraConfigs).map(([name, content])=>({
2177
+ name,
2178
+ content: 'string' == typeof content ? content : stringifyConfig(content, inspectOptions.verbose)
2179
+ })) : void 0;
2172
2180
  return inspectOptions.writeToDisk && await outputInspectConfigFiles({
2173
2181
  rawBundlerConfigs,
2174
2182
  rawEnvironmentConfigs,
2183
+ rawExtraConfigs,
2175
2184
  inspectOptions: {
2176
2185
  ...inspectOptions,
2177
2186
  outputPath
@@ -7299,11 +7308,11 @@ async function runCLI() {
7299
7308
  ].includes(level) && (logger.level = level);
7300
7309
  }
7301
7310
  let { npm_execpath } = process.env;
7302
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0\n`);
7311
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.1\n`);
7303
7312
  try {
7304
7313
  !function() {
7305
7314
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7306
- cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7315
+ cli.help(), cli.version("1.4.1"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7307
7316
  default: 'jiti'
7308
7317
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7309
7318
  type: [
@@ -7361,5 +7370,5 @@ async function runCLI() {
7361
7370
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
7362
7371
  }
7363
7372
  }
7364
- let src_version = "1.4.0";
7373
+ let src_version = "1.4.1";
7365
7374
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
@@ -13,16 +13,15 @@ export declare const getRsbuildInspectConfig: ({ normalizedConfig, inspectOption
13
13
  }>;
14
14
  environmentConfigs: InspectConfigResult["origin"]["environmentConfigs"];
15
15
  };
16
- export declare function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, configType, }: {
16
+ type RawConfig = {
17
+ name: string;
18
+ content: string;
19
+ };
20
+ export declare function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, rawExtraConfigs, configType, }: {
17
21
  configType: string;
18
- rawEnvironmentConfigs: Array<{
19
- name: string;
20
- content: string;
21
- }>;
22
- rawBundlerConfigs: Array<{
23
- name: string;
24
- content: string;
25
- }>;
22
+ rawExtraConfigs?: RawConfig[];
23
+ rawEnvironmentConfigs: RawConfig[];
24
+ rawBundlerConfigs: RawConfig[];
26
25
  inspectOptions: InspectConfigOptions & {
27
26
  outputPath: string;
28
27
  };
@@ -33,3 +32,4 @@ export declare function inspectConfig<B extends 'rspack' | 'webpack' = 'rspack'>
33
32
  bundlerConfigs: B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[];
34
33
  bundler?: 'rspack' | 'webpack';
35
34
  }): Promise<InspectConfigResult<B>>;
35
+ export {};
@@ -85,6 +85,19 @@ export type InspectConfigOptions = {
85
85
  * @default false
86
86
  */
87
87
  writeToDisk?: boolean;
88
+ /**
89
+ * Extra configurations to be output.
90
+ * - key: The name of the configuration
91
+ * - value: The configuration object
92
+ * @example
93
+ * extraConfigs: {
94
+ * // Output `rstest.config.mjs` file
95
+ * 'rstest': {
96
+ * // ...
97
+ * },
98
+ * }
99
+ */
100
+ extraConfigs?: Record<string, unknown>;
88
101
  };
89
102
  export type InspectConfigResult<B extends 'rspack' | 'webpack' = 'rspack'> = {
90
103
  rsbuildConfig: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,17 +46,17 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.4.0",
49
+ "@rspack/core": "1.4.1",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.43.0",
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@rslib/core": "0.10.2",
56
+ "@rslib/core": "0.10.3",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.19",
59
- "@types/node": "^22.15.32",
59
+ "@types/node": "^22.15.33",
60
60
  "@types/on-finished": "2.3.5",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
62
  "@types/ws": "^8.18.1",
@@ -82,7 +82,7 @@
82
82
  "prebundle": "1.3.3",
83
83
  "reduce-configs": "^1.1.0",
84
84
  "rsbuild-dev-middleware": "0.3.0",
85
- "rslog": "^1.2.7",
85
+ "rslog": "^1.2.8",
86
86
  "rspack-chain": "^1.2.6",
87
87
  "rspack-manifest-plugin": "5.0.3",
88
88
  "sirv": "^3.0.1",