bunchee 4.2.1 → 4.2.2

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
@@ -1,6 +1,6 @@
1
1
  # bunchee
2
2
 
3
- > zero config bundler for JavaScript/TypeScript/JSX library
3
+ > Zero-config bundler for frontend libraries.
4
4
 
5
5
  ![bunchee](https://repository-images.githubusercontent.com/154026156/5d132698-0ff5-4644-a4fd-d9570e6229bc)
6
6
 
@@ -15,6 +15,7 @@
15
15
  </p>
16
16
 
17
17
  Bunchee makes bundling your library into one file effortless, with zero configuration required. It is built on top of Rollup and SWC ⚡️, allowing you to focus on writing code and generating multiple module types (CommonJS, ESModules) simultaneously.
18
+ It uses the standard exports configuration in `package.json` as the only source of truth, and uses entry file conventions to match your exports and build them into bundles.
18
19
 
19
20
  ## Quick Start
20
21
 
package/dist/bin/cli.js CHANGED
@@ -55,7 +55,7 @@ async function fileExists(filePath) {
55
55
  }
56
56
  }
57
57
 
58
- var version = "4.2.1";
58
+ var version = "4.2.2";
59
59
 
60
60
  const helpMessage = `
61
61
  Usage: bunchee [options]
package/dist/index.js CHANGED
@@ -659,7 +659,7 @@ async function buildInputConfig(entry, entries, pkg, options, cwd, { tsConfigPat
659
659
  tsBuildInfoFile: '.tsbuildinfo',
660
660
  target: 'esnext',
661
661
  module: 'esnext',
662
- jsx: tsCompilerOptions.jsx || 'react'
662
+ jsx: tsCompilerOptions.jsx || 'react-jsx'
663
663
  };
664
664
  const typesPlugins = [
665
665
  ...commonPlugins,
@@ -1011,24 +1011,23 @@ function createChunkSizeCollector({ entries }) {
1011
1011
  plugin: (cwd)=>{
1012
1012
  return {
1013
1013
  name: 'collect-sizes',
1014
- augmentChunkHash () {
1015
- // Do nothing, but use the hook to keep the plugin instance alive
1016
- },
1017
- renderChunk (code, chunk, options) {
1018
- const sourceId = chunk.facadeModuleId || '';
1019
- const dir = options.dir || options.file && path__default.default.dirname(options.file);
1020
- let fileName = chunk.fileName;
1021
- if (dir) {
1014
+ writeBundle (options, bundle) {
1015
+ const dir = options.dir || path__default.default.dirname(options.file);
1016
+ Object.entries(bundle).forEach(([fileName, chunk])=>{
1022
1017
  const filePath = path__default.default.join(dir, fileName);
1023
- fileName = filePath.startsWith(cwd) ? path__default.default.relative(cwd, filePath) : filePath;
1024
- }
1025
- addSize({
1026
- fileName,
1027
- size: code.length,
1028
- sourceFileName: sourceId,
1029
- exportPath: reversedMapping.get(sourceId) || '.'
1018
+ if (chunk.type !== 'chunk') {
1019
+ return;
1020
+ }
1021
+ const size = chunk.code.length;
1022
+ const sourceFileName = chunk.facadeModuleId || '';
1023
+ const exportPath = reversedMapping.get(sourceFileName) || '.';
1024
+ addSize({
1025
+ fileName: filePath.startsWith(cwd) ? path__default.default.relative(cwd, filePath) : filePath,
1026
+ size,
1027
+ sourceFileName,
1028
+ exportPath
1029
+ });
1030
1030
  });
1031
- return null;
1032
1031
  }
1033
1032
  };
1034
1033
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",
@@ -25,6 +25,8 @@
25
25
  "jsx",
26
26
  "zero-config",
27
27
  "library",
28
+ "css",
29
+ "web",
28
30
  "server components"
29
31
  ],
30
32
  "files": [