bunchee 5.1.1 → 5.1.3

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/README.md CHANGED
@@ -162,14 +162,14 @@ Assuming you have default export package as `"."` and subpath export `"./lite"`
162
162
  {
163
163
  "name": "example",
164
164
  "scripts": {
165
- "build": "bunchee"
165
+ "build": "bunchee"
166
166
  },
167
167
  "exports": {
168
- "./lite": "./dist/lite.js"
168
+ "./lite": "./dist/lite.js",
169
169
  ".": {
170
170
  "import": "./dist/index.mjs",
171
171
  "require": "./dist/index.cjs"
172
- }
172
+ }
173
173
  }
174
174
  }
175
175
  ```
@@ -322,7 +322,6 @@ import { AppContext } from './app-context.shared-runtime'
322
322
  - Runtime (`--runtime <runtime>`): Set build runtime (default: `'browser'`).
323
323
  - Environment (`--env <env,>`): Define environment variables. (default: `NODE_ENV`, separate by comma)
324
324
  - Working Directory (`--cwd <cwd>`): Set current working directory where containing `package.json`.
325
- - Types (`--dts`): Generate TypeScript declaration files along with assets.
326
325
  - Minify (`-m`): Compress output.
327
326
  - Watch (`-w`): Watch for source file changes.
328
327
  - No Clean(`--no-clean`): Do not clean the dist folder before building. (default: `false`)
package/dist/bin/cli.js CHANGED
@@ -315,7 +315,7 @@ function addToExportDistMap(exportToDist, exportPath, outputConditionPairs, spec
315
315
  ],
316
316
  Boolean(moduleExportPath) && [
317
317
  moduleExportPath,
318
- 'import'
318
+ 'module'
319
319
  ],
320
320
  Boolean(typesEntryPath) && [
321
321
  typesEntryPath,
@@ -474,7 +474,7 @@ function lint$1(pkg) {
474
474
  }
475
475
  }
476
476
 
477
- var version = "5.1.1";
477
+ var version = "5.1.3";
478
478
 
479
479
  function relativify(path) {
480
480
  return path.startsWith('.') ? path : `./${path}`;
@@ -866,7 +866,6 @@ Options:
866
866
  --env <env> inlined process env variables, separate by comma. default: NODE_ENV
867
867
  --cwd <cwd> specify current working directory
868
868
  --sourcemap enable sourcemap generation, default: false
869
- --dts determine if need to generate types, default: undefined
870
869
  --no-dts do not generate types, default: undefined
871
870
  --tsconfig path to tsconfig file, default: tsconfig.json
872
871
  `;
@@ -884,7 +883,6 @@ function parseCliArgs(argv) {
884
883
  let args;
885
884
  args = arg__default.default({
886
885
  '--cwd': String,
887
- '--dts': Boolean,
888
886
  '--no-dts': Boolean,
889
887
  '--output': String,
890
888
  '--format': String,
@@ -920,7 +918,7 @@ function parseCliArgs(argv) {
920
918
  minify: args['--minify'],
921
919
  sourcemap: !!args['--sourcemap'],
922
920
  cwd: args['--cwd'],
923
- dts: args['--no-dts'] ? false : args['--dts'],
921
+ dts: args['--no-dts'] ? false : undefined,
924
922
  help: args['--help'],
925
923
  version: args['--version'],
926
924
  runtime: args['--runtime'],
@@ -939,7 +937,7 @@ async function run(args) {
939
937
  const cwd = args.cwd || process.cwd();
940
938
  const file = args.file ? path__default.default.resolve(cwd, args.file) : undefined;
941
939
  const bundleConfig = {
942
- dts: typeof dts === 'boolean' ? dts : undefined,
940
+ dts,
943
941
  file,
944
942
  format,
945
943
  cwd,
package/dist/index.js CHANGED
@@ -125,6 +125,7 @@ const dtsExtensionsMap = {
125
125
  mjs: 'd.mts'
126
126
  };
127
127
  const disabledWarnings = new Set([
128
+ 'EMPTY_BUNDLE',
128
129
  'MIXED_EXPORTS',
129
130
  'PREFER_NAMED_EXPORTS',
130
131
  'UNRESOLVED_IMPORT',
@@ -550,7 +551,8 @@ function aliasEntries({ entry, entries, entriesAlias, format, dts, cwd }) {
550
551
  const typeCond = (_Object_entries_find = Object.entries(exportDistMaps).find(([composedKey, cond])=>{
551
552
  const typesSet = new Set(composedKey.split('.'));
552
553
  const formatCond = format === 'cjs' ? 'require' : 'import';
553
- return typesSet.has('types') && typesSet.has(formatCond) && cond != null;
554
+ const isMatchedCond = typesSet.has(formatCond) || !typesSet.has('import') && !typesSet.has('require');
555
+ return typesSet.has('types') && isMatchedCond && cond != null;
554
556
  })) == null ? void 0 : _Object_entries_find[1];
555
557
  if (typeCond) {
556
558
  pathToRelativeDistMap.set(exportCondition.source, typeCond);
@@ -759,7 +761,7 @@ function addToExportDistMap(exportToDist, exportPath, outputConditionPairs, spec
759
761
  ],
760
762
  Boolean(moduleExportPath) && [
761
763
  moduleExportPath,
762
- 'import'
764
+ 'module'
763
765
  ],
764
766
  Boolean(typesEntryPath) && [
765
767
  typesEntryPath,
@@ -1760,7 +1762,7 @@ async function bundle(cliEntryPath, { cwd: _cwd, ...options } = {}) {
1760
1762
  mainExportPath = options.file;
1761
1763
  }
1762
1764
  if (mainExportPath) {
1763
- if (options.dts) {
1765
+ if (options.dts !== false) {
1764
1766
  typesEntryPath = getExportFileTypePath(mainExportPath);
1765
1767
  }
1766
1768
  parsedExportsInfo.set('./index', [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",
@@ -42,15 +42,15 @@
42
42
  "@rollup/plugin-replace": "^5.0.5",
43
43
  "@rollup/plugin-wasm": "^6.2.2",
44
44
  "@rollup/pluginutils": "^5.1.0",
45
- "@swc/core": "^1.4.8",
46
- "@swc/helpers": "^0.5.6",
45
+ "@swc/core": "^1.5.0",
46
+ "@swc/helpers": "^0.5.11",
47
47
  "arg": "^5.0.2",
48
48
  "clean-css": "^5.3.3",
49
- "magic-string": "^0.30.8",
49
+ "magic-string": "^0.30.10",
50
50
  "pretty-bytes": "^5.6.0",
51
- "rollup": "^4.13.0",
51
+ "rollup": "^4.16.4",
52
52
  "rollup-plugin-dts": "^6.1.0",
53
- "rollup-plugin-swc3": "^0.11.0",
53
+ "rollup-plugin-swc3": "^0.11.1",
54
54
  "rollup-preserve-directives": "^1.1.1",
55
55
  "tslib": "^2.6.2"
56
56
  },