@rslib/core 0.0.14 → 0.0.15

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
@@ -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.14\n`);
153
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.15\n`);
154
154
  }
155
155
  const DEFAULT_CONFIG_NAME = 'rslib.config';
156
156
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -1432,7 +1432,8 @@ function composeMinifyConfig(config) {
1432
1432
  jsOptions: {
1433
1433
  minimizerOptions: {
1434
1434
  mangle: false,
1435
- minify: false,
1435
+ // MF assets are loaded over the network, which means they will not be compressed by the project. Therefore, minifying them is necessary.
1436
+ minify: 'mf' === format,
1436
1437
  compress: {
1437
1438
  defaults: false,
1438
1439
  unused: true,
@@ -1739,7 +1740,10 @@ const composeExternalsConfig = (format, externals)=>{
1739
1740
  esm: 'module-import',
1740
1741
  cjs: 'commonjs',
1741
1742
  umd: 'umd',
1742
- mf: 'var'
1743
+ // If use 'var', when projects import an external package like '@pkg', this will cause a syntax error such as 'var pkg = @pkg'.
1744
+ // If use 'umd', the judgement conditions may be affected by other packages that define variables like 'define'.
1745
+ // Therefore, we use 'global' to satisfy both web and node environments.
1746
+ mf: 'global'
1743
1747
  };
1744
1748
  switch(format){
1745
1749
  case 'esm':
@@ -1905,13 +1909,19 @@ const composeBundleConfig = (jsExtension, redirect, cssModulesAuto, bundle)=>{
1905
1909
  };
1906
1910
  };
1907
1911
  const composeDtsConfig = async (libConfig, dtsExtension)=>{
1908
- const { dts, bundle, output, autoExternal, banner, footer } = libConfig;
1912
+ const { output, autoExternal, banner, footer } = libConfig;
1913
+ let { dts } = libConfig;
1909
1914
  if (false === dts || void 0 === dts) return {};
1915
+ // DTS default to bundleless whether js is bundle or not
1916
+ if (true === dts) dts = {
1917
+ bundle: false
1918
+ };
1910
1919
  const { pluginDts } = await import("rsbuild-plugin-dts");
1911
1920
  return {
1912
1921
  plugins: [
1913
1922
  pluginDts({
1914
- bundle: dts?.bundle ?? bundle,
1923
+ // Only setting ⁠dts.bundle to true will generate the bundled d.ts.
1924
+ bundle: dts?.bundle ?? false,
1915
1925
  distPath: dts?.distPath ?? output?.distPath?.root ?? './dist',
1916
1926
  abortOnError: dts?.abortOnError ?? true,
1917
1927
  dtsExtension: dts?.autoExtension ? dtsExtension : '.d.ts',
@@ -2108,7 +2118,7 @@ const applyCommonOptions = (command)=>{
2108
2118
  command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file');
2109
2119
  };
2110
2120
  function runCli() {
2111
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.14");
2121
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.15");
2112
2122
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
2113
2123
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
2114
2124
  [
@@ -2150,6 +2160,6 @@ function runCli() {
2150
2160
  });
2151
2161
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
2152
2162
  }
2153
- const src_version = "0.0.14";
2163
+ const src_version = "0.0.15";
2154
2164
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
2155
2165
  export { build, defineConfig, loadConfig, prepareCli, runCli, src_version as version, __webpack_exports__logger as logger };
@@ -8,7 +8,7 @@ export type RsbuildConfigOutputTarget = NonNullable<RsbuildConfig['output']>['ta
8
8
  export type Syntax = EcmaScriptVersion | string[];
9
9
  export type Dts = (Pick<PluginDtsOptions, 'bundle' | 'distPath' | 'abortOnError'> & {
10
10
  autoExtension?: boolean;
11
- }) | false;
11
+ }) | boolean;
12
12
  export type AutoExternal = boolean | {
13
13
  dependencies?: boolean;
14
14
  devDependencies?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "The Rspack-based library build tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -32,9 +32,9 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.0.17",
36
- "tinyglobby": "^0.2.9",
37
- "rsbuild-plugin-dts": "0.0.14"
35
+ "@rsbuild/core": "~1.0.18",
36
+ "tinyglobby": "^0.2.10",
37
+ "rsbuild-plugin-dts": "0.0.15"
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.2",
47
- "rslib": "npm:@rslib/core@0.0.13",
47
+ "rslib": "npm:@rslib/core@0.0.14",
48
48
  "rslog": "^1.2.3",
49
49
  "tsconfck": "3.1.4",
50
50
  "typescript": "^5.6.3",