bunchee 6.5.3 → 6.5.4

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/bin/cli.js CHANGED
@@ -646,7 +646,7 @@ function lint$1(pkg) {
646
646
  }
647
647
  }
648
648
 
649
- var version = "6.5.3";
649
+ var version = "6.5.4";
650
650
 
651
651
  async function writeDefaultTsconfig(tsConfigPath) {
652
652
  await fs.promises.writeFile(tsConfigPath, JSON.stringify(DEFAULT_TS_CONFIG, null, 2), 'utf-8');
package/dist/index.js CHANGED
@@ -1448,7 +1448,6 @@ async function createDtsPlugin(tsCompilerOptions, tsConfigPath, respectExternal,
1448
1448
  noEmitOnError: true,
1449
1449
  emitDeclarationOnly: true,
1450
1450
  checkJs: false,
1451
- declarationMap: false,
1452
1451
  skipLibCheck: true,
1453
1452
  // preserveSymlinks should always be set to false to avoid issues with
1454
1453
  // resolving types from <reference> from node_modules
@@ -1721,6 +1720,18 @@ async function buildOutputConfigs(bundleConfig, exportCondition, buildContext, d
1721
1720
  const jsDir = path.dirname(absoluteOutputFile);
1722
1721
  const outputFile = dts ? dtsFile : absoluteOutputFile;
1723
1722
  const entryFiles = new Set(Object.values(entries).map((entry)=>entry.source));
1723
+ // By default, respect the original bunchee sourcemap option
1724
+ let sourcemap = !!bundleConfig.sourcemap;
1725
+ // If it's typescript, checking if declaration map is enabled,
1726
+ // otherwise we don't enable sourcemap for type files.
1727
+ // cases:
1728
+ // sourcemap (✓) + declarationMap (✓) => sourcemap for dts
1729
+ // sourcemap (✗) + declarationMap (✓) => sourcemap for dts
1730
+ // sourcemap (✓) + declarationMap (✗) => no sourcemap for dts
1731
+ // sourcemap (✗) + declarationMap (✗) => no sourcemap for dts
1732
+ if (dts) {
1733
+ sourcemap = !!(tsCompilerOptions == null ? void 0 : tsCompilerOptions.declarationMap);
1734
+ }
1724
1735
  const outputOptions = {
1725
1736
  name: pkg.name || name,
1726
1737
  extend: true,
@@ -1731,7 +1742,7 @@ async function buildOutputConfigs(bundleConfig, exportCondition, buildContext, d
1731
1742
  interop: 'auto',
1732
1743
  freeze: false,
1733
1744
  strict: false,
1734
- sourcemap: bundleConfig.sourcemap && !dts,
1745
+ sourcemap,
1735
1746
  manualChunks: createSplitChunks(pluginContext.moduleDirectiveLayerMap, entryFiles),
1736
1747
  chunkFileNames () {
1737
1748
  const isCjsFormat = format === 'cjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "6.5.3",
3
+ "version": "6.5.4",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",