@rslib/core 0.0.17 → 0.0.18

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -8
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -150,7 +150,7 @@ function prepareCli() {
150
150
  // Some package managers automatically output a blank line, some do not.
151
151
  const { npm_execpath } = process.env;
152
152
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
153
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.17\n`);
153
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.18\n`);
154
154
  }
155
155
  const DEFAULT_CONFIG_NAME = 'rslib.config';
156
156
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -1673,7 +1673,6 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1673
1673
  output: {
1674
1674
  uniqueName: pkgJson.name
1675
1675
  },
1676
- // TODO when we provide dev mode for rslib mf format, this should be modified to as the same with config.mode
1677
1676
  // can not set nodeEnv to false, because mf format should build shared module.
1678
1677
  // If nodeEnv is false, the process.env.NODE_ENV in third-party packages's will not be replaced
1679
1678
  // now we have not provide dev mode for users, so we can always set nodeEnv as 'production'
@@ -1681,6 +1680,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1681
1680
  nodeEnv: 'production'
1682
1681
  }
1683
1682
  }
1683
+ },
1684
+ output: {
1685
+ target: 'web'
1684
1686
  }
1685
1687
  };
1686
1688
  default:
@@ -1930,8 +1932,10 @@ const composeDtsConfig = async (libConfig, dtsExtension)=>{
1930
1932
  ]
1931
1933
  };
1932
1934
  };
1933
- const composeTargetConfig = (target = 'node')=>{
1934
- switch(target){
1935
+ const composeTargetConfig = (target, format)=>{
1936
+ let defaultTarget = target;
1937
+ if (!defaultTarget) defaultTarget = 'mf' === format ? 'web' : 'node';
1938
+ switch(defaultTarget){
1935
1939
  case 'web':
1936
1940
  return {
1937
1941
  config: {
@@ -1975,7 +1979,7 @@ const composeTargetConfig = (target = 'node')=>{
1975
1979
  // },
1976
1980
  // };
1977
1981
  default:
1978
- throw new Error(`Unsupported platform: ${target}`);
1982
+ throw new Error(`Unsupported platform: ${defaultTarget}`);
1979
1983
  }
1980
1984
  };
1981
1985
  const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
@@ -2024,7 +2028,7 @@ async function composeLibRsbuildConfig(config, configPath) {
2024
2028
  const externalsConfig = composeExternalsConfig(format, config.output?.externals);
2025
2029
  const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
2026
2030
  const bundleConfig = composeBundleConfig(jsExtension, redirect, cssModulesAuto, bundle);
2027
- const { config: targetConfig, target } = composeTargetConfig(config.output?.target);
2031
+ const { config: targetConfig, target } = composeTargetConfig(config.output?.target, format);
2028
2032
  const syntaxConfig = composeSyntaxConfig(target, config?.syntax);
2029
2033
  const autoExternalConfig = composeAutoExternalConfig({
2030
2034
  autoExternal,
@@ -2161,7 +2165,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2161
2165
  value
2162
2166
  ]);
2163
2167
  function runCli() {
2164
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.17");
2168
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.18");
2165
2169
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
2166
2170
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
2167
2171
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('mf dev');
@@ -2223,6 +2227,6 @@ function runCli() {
2223
2227
  });
2224
2228
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
2225
2229
  }
2226
- const src_version = "0.0.17";
2230
+ const src_version = "0.0.18";
2227
2231
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
2228
2232
  export { build, defineConfig, loadConfig, prepareCli, runCli, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@rsbuild/core": "~1.1.0",
36
36
  "tinyglobby": "^0.2.10",
37
- "rsbuild-plugin-dts": "0.0.17"
37
+ "rsbuild-plugin-dts": "0.0.18"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@rspack/core": "1.0.8",
@@ -44,7 +44,7 @@
44
44
  "memfs": "^4.14.0",
45
45
  "picocolors": "1.1.1",
46
46
  "prebundle": "1.2.5",
47
- "rslib": "npm:@rslib/core@0.0.16",
47
+ "rslib": "npm:@rslib/core@0.0.17",
48
48
  "rslog": "^1.2.3",
49
49
  "tsconfck": "3.1.4",
50
50
  "typescript": "^5.6.3",