bunchee 2.1.7 → 2.2.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.
package/dist/cli.js CHANGED
@@ -27,7 +27,7 @@ var logger = {
27
27
  }
28
28
  };
29
29
 
30
- var version = "2.1.7";
30
+ var version = "2.2.1";
31
31
 
32
32
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
33
33
  try {
package/dist/lib.js CHANGED
@@ -236,6 +236,7 @@ function buildInputConfig(entry, pkg, options, param) {
236
236
  pkg.name
237
237
  ] : []));
238
238
  var useTypescript = options.useTypescript, runtime = options.runtime, jscTarget = options.target, minify = options.minify;
239
+ var hasSpecifiedTsTarget = Boolean((tsCompilerOptions == null ? void 0 : tsCompilerOptions.target) && tsConfigPath);
239
240
  var _obj;
240
241
  var plugins = (dtsOnly ? [
241
242
  shebang__default["default"](),
@@ -252,7 +253,7 @@ function buildInputConfig(entry, pkg, options, param) {
252
253
  target: "esnext",
253
254
  module: "esnext",
254
255
  incremental: false,
255
- jsx: (tsCompilerOptions == null ? void 0 : tsCompilerOptions.jsx) || "react"
256
+ jsx: tsCompilerOptions.jsx || "react"
256
257
  })
257
258
  })
258
259
  ] : [
@@ -275,8 +276,9 @@ function buildInputConfig(entry, pkg, options, param) {
275
276
  include: /\.(m|c)?[jt]sx?$/,
276
277
  exclude: "node_modules",
277
278
  tsconfig: tsConfigPath,
278
- jsc: _extends$1({
279
- target: jscTarget,
279
+ jsc: _extends$1({}, !hasSpecifiedTsTarget && {
280
+ target: jscTarget
281
+ }, {
280
282
  loose: true,
281
283
  externalHelpers: false,
282
284
  parser: (_obj = {
@@ -599,6 +601,7 @@ function assignDefault(options, name, defaultValue) {
599
601
  }
600
602
  // Map '.' -> './index.[ext]'
601
603
  // Map './lite' -> './lite.[ext]'
604
+ // Return undefined if no match or if it's package.json exports
602
605
  function getSourcePathFromExportPath(cwd, exportPath) {
603
606
  var exts = [
604
607
  "js",
@@ -663,7 +666,9 @@ function _bundle() {
663
666
  isSingleEntry = typeof packageExports === "string";
664
667
  hasMultiEntries = packageExports && !isSingleEntry && Object.keys(packageExports).length > 0;
665
668
  if (isSingleEntry) {
666
- entryPath = getSourcePathFromExportPath(config.rootDir, ".");
669
+ // Use specified string file path if possible, then fallback to the default behavior entry picking logic
670
+ // e.g. "exports": "./dist/index.js" -> use "./index.<ext>" as entry
671
+ entryPath = entryPath || getSourcePathFromExportPath(config.rootDir, ".") || "";
667
672
  }
668
673
  bundleOrWatch = function(rollupConfig) {
669
674
  var input = rollupConfig.input, exportName = rollupConfig.exportName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "2.1.7",
3
+ "version": "2.2.1",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": {
6
6
  "bunchee": "./dist/cli.js"