bunchee 5.0.0-beta.3 → 5.0.0-beta.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/README.md CHANGED
@@ -326,6 +326,7 @@ import { AppContext } from './app-context.shared-runtime'
326
326
  - Minify (`-m`): Compress output.
327
327
  - Watch (`-w`): Watch for source file changes.
328
328
  - No Clean(`--no-clean`): Do not clean the dist folder before building. (default: `false`)
329
+ - TSConfig (`--tsconfig <path>`): Specify the path to the TypeScript configuration file. (default: `tsconfig.json`)
329
330
 
330
331
  ```sh
331
332
  cd <project-root-dir>
@@ -458,6 +459,7 @@ await bundle(path.resolve('./src/index.ts'), {
458
459
  runtime: 'nodejs', // 'browser' | 'nodejs'
459
460
  cwd: process.cwd(), // string
460
461
  clean: true, // boolean
462
+ tsconfig: 'tsconfig.json', // string
461
463
  })
462
464
  ```
463
465
 
package/dist/bin/cli.js CHANGED
@@ -456,7 +456,7 @@ function lint$1(pkg) {
456
456
  }
457
457
  }
458
458
 
459
- var version = "5.0.0-beta.3";
459
+ var version = "5.0.0-beta.4";
460
460
 
461
461
  function relativify(path) {
462
462
  return path.startsWith('.') ? path : `./${path}`;
@@ -799,6 +799,7 @@ Options:
799
799
  --sourcemap enable sourcemap generation, default: false
800
800
  --dts determine if need to generate types, default: undefined
801
801
  --no-dts do not generate types, default: undefined
802
+ --tsconfig path to tsconfig file, default: tsconfig.json
802
803
  `;
803
804
  function help() {
804
805
  logger.log(helpMessage);
@@ -830,6 +831,7 @@ function parseCliArgs(argv) {
830
831
  '--no-external': Boolean,
831
832
  '--no-clean': Boolean,
832
833
  '--prepare': Boolean,
834
+ '--tsconfig': String,
833
835
  '-h': '--help',
834
836
  '-v': '--version',
835
837
  '-w': '--watch',
@@ -857,13 +859,14 @@ function parseCliArgs(argv) {
857
859
  external: !!args['--no-external'] ? null : args['--external'],
858
860
  clean: !args['--no-clean'],
859
861
  env: args['--env'],
860
- prepare: !!args['--prepare']
862
+ prepare: !!args['--prepare'],
863
+ tsconfig: args['--tsconfig']
861
864
  };
862
865
  return parsedArgs;
863
866
  }
864
867
  async function run(args) {
865
868
  var _args_external;
866
- const { source, format, watch, minify, sourcemap, target, runtime, dts, env, clean } = args;
869
+ const { source, format, watch, minify, sourcemap, target, runtime, dts, env, clean, tsconfig } = args;
867
870
  const cwd = args.cwd || process.cwd();
868
871
  const file = args.file ? path__default.default.resolve(cwd, args.file) : undefined;
869
872
  const bundleConfig = {
@@ -878,7 +881,8 @@ async function run(args) {
878
881
  minify: !!minify,
879
882
  sourcemap: sourcemap === false ? false : true,
880
883
  env: (env == null ? void 0 : env.split(',')) || [],
881
- clean
884
+ clean,
885
+ tsconfig
882
886
  };
883
887
  if (args.version) {
884
888
  return logger.log(version);
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ type BundleConfig = {
18
18
  runtime?: string;
19
19
  pkg?: PackageMetadata;
20
20
  clean?: boolean;
21
+ tsconfig?: string;
21
22
  };
22
23
  type PackageMetadata = {
23
24
  name?: string;
package/dist/index.js CHANGED
@@ -305,10 +305,10 @@ function resolveTypescriptHandler(cwd) {
305
305
  return ts;
306
306
  }
307
307
  const resolveTypescript = memoize(resolveTypescriptHandler);
308
- function resolveTsConfigHandler(cwd) {
308
+ function resolveTsConfigHandler(cwd, tsconfig = 'tsconfig.json') {
309
309
  let tsCompilerOptions = {};
310
310
  let tsConfigPath;
311
- tsConfigPath = path.resolve(cwd, 'tsconfig.json');
311
+ tsConfigPath = path.resolve(cwd, tsconfig);
312
312
  if (fileExists(tsConfigPath)) {
313
313
  const ts = resolveTypescript(cwd);
314
314
  const basePath = tsConfigPath ? path.dirname(tsConfigPath) : cwd;
@@ -1573,7 +1573,7 @@ async function bundle(cliEntryPath, { cwd: _cwd, ...options } = {}) {
1573
1573
  // Original input file path, client path might change later
1574
1574
  const inputFile = cliEntryPath;
1575
1575
  const isFromCli = Boolean(cliEntryPath);
1576
- let tsConfig = resolveTsConfig(cwd);
1576
+ let tsConfig = resolveTsConfig(cwd, options.tsconfig);
1577
1577
  let hasTsConfig = Boolean(tsConfig == null ? void 0 : tsConfig.tsConfigPath);
1578
1578
  const defaultTsOptions = {
1579
1579
  tsConfigPath: tsConfig == null ? void 0 : tsConfig.tsConfigPath,
package/package.json CHANGED
@@ -1,10 +1,21 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "5.0.0-beta.3",
3
+ "version": "5.0.0-beta.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",
7
7
  "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "test": "jest --env node",
10
+ "test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
11
+ "test:post": "POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
12
+ "clean": "rm -rf ./dist",
13
+ "typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
14
+ "prepublishOnly": "pnpm clean && pnpm build && chmod +x ./dist/bin/cli.js && pnpm test",
15
+ "build": "tsx ./src/bin/index.ts --runtime node",
16
+ "format": "prettier --write .",
17
+ "prepare": "husky install"
18
+ },
8
19
  "type": "commonjs",
9
20
  "keywords": [
10
21
  "bundler",
@@ -104,14 +115,5 @@
104
115
  ],
105
116
  "testTimeout": 60000
106
117
  },
107
- "packageManager": "pnpm@8.8.0",
108
- "scripts": {
109
- "test": "jest --env node",
110
- "test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
111
- "test:post": "POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
112
- "clean": "rm -rf ./dist",
113
- "typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
114
- "build": "tsx ./src/bin/index.ts --runtime node",
115
- "format": "prettier --write ."
116
- }
117
- }
118
+ "packageManager": "pnpm@8.8.0"
119
+ }