@rslib/core 0.6.8 → 0.7.0

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.js CHANGED
@@ -181,7 +181,7 @@ function prepareCli() {
181
181
  initNodeEnv();
182
182
  const { npm_execpath } = process.env;
183
183
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
184
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.6.8\n`);
184
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.7.0\n`);
185
185
  }
186
186
  const DEFAULT_CONFIG_NAME = 'rslib.config';
187
187
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -1765,6 +1765,7 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1765
1765
  return config;
1766
1766
  }
1767
1767
  case 'mf':
1768
+ if (false === bundle) throw new Error('When using "mf" format, "bundle" must be set to "true". Since the default value for "bundle" is "true", so you can either explicitly set it to "true" or remove the field entirely.');
1768
1769
  return {
1769
1770
  dev: {
1770
1771
  writeToDisk: true
@@ -1885,9 +1886,9 @@ const composeExternalsConfig = (format, externals)=>{
1885
1886
  throw new Error(`Unsupported format: ${format}`);
1886
1887
  }
1887
1888
  };
1888
- const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
1889
+ const composeAutoExtensionConfig = (config, format, autoExtension, pkgJson)=>{
1889
1890
  const { jsExtension, dtsExtension } = getDefaultExtension({
1890
- format: config.format,
1891
+ format,
1891
1892
  pkgJson,
1892
1893
  autoExtension
1893
1894
  });
@@ -2112,8 +2113,8 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
2112
2113
  }
2113
2114
  };
2114
2115
  };
2115
- const composeDtsConfig = async (libConfig, dtsExtension)=>{
2116
- const { format, autoExternal, banner, footer, redirect } = libConfig;
2116
+ const composeDtsConfig = async (libConfig, format, dtsExtension)=>{
2117
+ const { autoExternal, banner, footer, redirect } = libConfig;
2117
2118
  let { dts } = libConfig;
2118
2119
  if (false === dts || void 0 === dts) return {};
2119
2120
  if (true === dts) dts = {
@@ -2212,24 +2213,24 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
2212
2213
  const pkgJson = readPackageJson(rootPath);
2213
2214
  const { compilerOptions } = await loadTsconfig(rootPath, config.source?.tsconfigPath);
2214
2215
  const cssModulesAuto = config.output?.cssModules?.auto ?? true;
2215
- const { format, shims, bundle = true, banner = {}, footer = {}, autoExtension = true, autoExternal, externalHelpers = false, redirect = {}, umdName } = config;
2216
+ const { format = 'esm', shims, bundle = true, banner = {}, footer = {}, autoExtension = true, autoExternal, externalHelpers = false, redirect = {}, umdName } = config;
2216
2217
  const { rsbuildConfig: shimsConfig, enabledShims } = composeShimsConfig(format, shims);
2217
2218
  const formatConfig = composeFormatConfig({
2218
- format: format,
2219
+ format,
2219
2220
  pkgJson: pkgJson,
2220
2221
  bundle,
2221
2222
  umdName
2222
2223
  });
2223
2224
  const externalHelpersConfig = composeExternalHelpersConfig(externalHelpers, pkgJson);
2224
2225
  const userExternalsConfig = composeExternalsConfig(format, config.output?.externals);
2225
- const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
2226
+ const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, format, autoExtension, pkgJson);
2226
2227
  const { entryConfig, outBase } = await composeEntryConfig(config.source?.entry, config.bundle, rootPath, cssModulesAuto, config.outBase);
2227
2228
  const { config: bundlelessExternalConfig } = composeBundlelessExternalConfig(jsExtension, redirect, cssModulesAuto, bundle, outBase);
2228
2229
  const { config: targetConfig, externalsConfig: targetExternalsConfig, target } = composeTargetConfig(config.output?.target, format);
2229
2230
  const syntaxConfig = composeSyntaxConfig(target, config?.syntax);
2230
2231
  const autoExternalConfig = composeAutoExternalConfig({
2231
2232
  bundle,
2232
- format: format,
2233
+ format,
2233
2234
  autoExternal,
2234
2235
  pkgJson,
2235
2236
  userExternals: config.output?.externals
@@ -2240,7 +2241,7 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
2240
2241
  enabledImportMetaUrlShim: enabledShims.cjs['import.meta.url'],
2241
2242
  contextToWatch: outBase
2242
2243
  });
2243
- const dtsConfig = await composeDtsConfig(config, dtsExtension);
2244
+ const dtsConfig = await composeDtsConfig(config, format, dtsExtension);
2244
2245
  const externalsWarnConfig = composeExternalsWarnConfig(format, userExternalsConfig?.output?.externals, autoExternalConfig?.output?.externals);
2245
2246
  const minifyConfig = composeMinifyConfig(config);
2246
2247
  const bannerFooterConfig = composeBannerFooterConfig(banner, footer);
@@ -2259,7 +2260,7 @@ async function composeCreateRsbuildConfig(rslibConfig) {
2259
2260
  userConfig.output ??= {};
2260
2261
  delete userConfig.output.externals;
2261
2262
  const config = {
2262
- format: libConfig.format,
2263
+ format: libConfig.format ?? 'esm',
2263
2264
  config: (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
2264
2265
  id: true,
2265
2266
  bundle: true,
@@ -2359,6 +2360,7 @@ const beforeRestart = async ({ filePath, clear = true } = {})=>{
2359
2360
  async function build(config, options = {}) {
2360
2361
  const { environments } = await composeRsbuildEnvironments(config);
2361
2362
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2363
+ callerName: 'rslib',
2362
2364
  rsbuildConfig: {
2363
2365
  mode: 'production',
2364
2366
  root: config.root,
@@ -2410,6 +2412,7 @@ async function init(options) {
2410
2412
  async function inspect(config, options = {}) {
2411
2413
  const { environments } = await composeRsbuildEnvironments(config);
2412
2414
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2415
+ callerName: 'rslib',
2413
2416
  rsbuildConfig: {
2414
2417
  mode: 'production',
2415
2418
  root: config.root,
@@ -2441,6 +2444,7 @@ async function initMFRsbuild(config, options = {}) {
2441
2444
  if (!selectedEnvironmentIds.length) throw new Error(`No mf format found in ${options.lib ? `libs ${options.lib.map((lib)=>`"${lib}"`).join(', ')}` : 'your config'}, please check your config to ensure that the mf format is enabled correctly.`);
2442
2445
  const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
2443
2446
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2447
+ callerName: 'rslib',
2444
2448
  rsbuildConfig: {
2445
2449
  mode: 'development',
2446
2450
  root: config.root,
@@ -2461,7 +2465,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2461
2465
  value
2462
2466
  ]);
2463
2467
  function runCli() {
2464
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.8");
2468
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.7.0");
2465
2469
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
2466
2470
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
2467
2471
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
@@ -2522,7 +2526,7 @@ function runCli() {
2522
2526
  });
2523
2527
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
2524
2528
  }
2525
- const src_version = "0.6.8";
2529
+ const src_version = "0.7.0";
2526
2530
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
2527
2531
  var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
2528
2532
  export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -170,7 +170,7 @@ export interface LibConfig extends EnvironmentConfig {
170
170
  id?: string;
171
171
  /**
172
172
  * Output format for the generated JavaScript files.
173
- * @defaultValue `undefined`
173
+ * @defaultValue `'esm'`
174
174
  * @see {@link https://lib.rsbuild.dev/config/lib/format}
175
175
  */
176
176
  format?: Format;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.6.8",
3
+ "version": "0.7.0",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -36,9 +36,9 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "1.3.14",
39
+ "@rsbuild/core": "1.3.19",
40
40
  "tinyglobby": "^0.2.13",
41
- "rsbuild-plugin-dts": "0.6.8"
41
+ "rsbuild-plugin-dts": "0.7.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@module-federation/rsbuild-plugin": "^0.13.1",
@@ -46,11 +46,11 @@
46
46
  "chokidar": "^4.0.3",
47
47
  "commander": "^13.1.0",
48
48
  "fs-extra": "^11.3.0",
49
- "memfs": "^4.17.0",
49
+ "memfs": "^4.17.1",
50
50
  "picocolors": "1.1.1",
51
51
  "prebundle": "1.3.3",
52
- "rsbuild-plugin-publint": "^0.3.1",
53
- "rslib": "npm:@rslib/core@0.6.7",
52
+ "rsbuild-plugin-publint": "^0.3.2",
53
+ "rslib": "npm:@rslib/core@0.6.9",
54
54
  "rslog": "^1.2.3",
55
55
  "tsconfck": "3.1.5",
56
56
  "typescript": "^5.8.3",