bunchee 5.3.2 → 5.4.0
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 +1 -0
- package/dist/bin/cli.js +8 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -326,6 +326,7 @@ import { AppContext } from './app-context.shared-runtime'
|
|
|
326
326
|
- Watch (`-w`): Watch for source file changes.
|
|
327
327
|
- No Clean(`--no-clean`): Do not clean the dist folder before building. (default: `false`)
|
|
328
328
|
- TSConfig (`--tsconfig <path>`): Specify the path to the TypeScript configuration file. (default: `tsconfig.json`)
|
|
329
|
+
- Bundle Types (`--dts-bundle`): Bundle type declaration files. (default: `false`)
|
|
329
330
|
|
|
330
331
|
```sh
|
|
331
332
|
cd <project-root-dir>
|
package/dist/bin/cli.js
CHANGED
|
@@ -470,7 +470,7 @@ function lint$1(pkg) {
|
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
var version = "5.
|
|
473
|
+
var version = "5.4.0";
|
|
474
474
|
|
|
475
475
|
function relativify(path) {
|
|
476
476
|
return path.startsWith('.') ? path : `./${path}`;
|
|
@@ -921,6 +921,7 @@ Options:
|
|
|
921
921
|
--sourcemap enable sourcemap generation, default: false
|
|
922
922
|
--no-dts do not generate types, default: undefined
|
|
923
923
|
--tsconfig path to tsconfig file, default: tsconfig.json
|
|
924
|
+
--dts-bundle bundle type declaration files, default: false
|
|
924
925
|
`;
|
|
925
926
|
function help() {
|
|
926
927
|
logger.log(helpMessage);
|
|
@@ -952,6 +953,7 @@ function parseCliArgs(argv) {
|
|
|
952
953
|
'--no-clean': Boolean,
|
|
953
954
|
'--prepare': Boolean,
|
|
954
955
|
'--tsconfig': String,
|
|
956
|
+
'--dts-bundle': Boolean,
|
|
955
957
|
'-h': '--help',
|
|
956
958
|
'-v': '--version',
|
|
957
959
|
'-w': '--watch',
|
|
@@ -972,6 +974,7 @@ function parseCliArgs(argv) {
|
|
|
972
974
|
sourcemap: !!args['--sourcemap'],
|
|
973
975
|
cwd: args['--cwd'],
|
|
974
976
|
dts: args['--no-dts'] ? false : undefined,
|
|
977
|
+
dtsBundle: args['--dts-bundle'],
|
|
975
978
|
help: args['--help'],
|
|
976
979
|
version: args['--version'],
|
|
977
980
|
runtime: args['--runtime'],
|
|
@@ -986,11 +989,13 @@ function parseCliArgs(argv) {
|
|
|
986
989
|
}
|
|
987
990
|
async function run(args) {
|
|
988
991
|
var _args_external;
|
|
989
|
-
const { source, format, watch, minify, sourcemap, target, runtime, dts, env, clean, tsconfig } = args;
|
|
992
|
+
const { source, format, watch, minify, sourcemap, target, runtime, dts, dtsBundle, env, clean, tsconfig } = args;
|
|
990
993
|
const cwd = args.cwd || process.cwd();
|
|
991
994
|
const file = args.file ? path__default.default.resolve(cwd, args.file) : undefined;
|
|
992
995
|
const bundleConfig = {
|
|
993
|
-
dts
|
|
996
|
+
dts: dts !== false && {
|
|
997
|
+
respectExternal: dtsBundle ? true : undefined
|
|
998
|
+
},
|
|
994
999
|
file,
|
|
995
1000
|
format,
|
|
996
1001
|
cwd,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1282,7 +1282,7 @@ const swcMinifyOptions = {
|
|
|
1282
1282
|
toplevel: true
|
|
1283
1283
|
}
|
|
1284
1284
|
};
|
|
1285
|
-
async function createDtsPlugin(tsCompilerOptions, tsConfigPath, cwd) {
|
|
1285
|
+
async function createDtsPlugin(tsCompilerOptions, tsConfigPath, respectExternal, cwd) {
|
|
1286
1286
|
const enableIncrementalWithoutBuildInfo = tsCompilerOptions.incremental && !tsCompilerOptions.tsBuildInfoFile;
|
|
1287
1287
|
const incrementalOptions = enableIncrementalWithoutBuildInfo ? {
|
|
1288
1288
|
incremental: false
|
|
@@ -1313,7 +1313,8 @@ async function createDtsPlugin(tsCompilerOptions, tsConfigPath, cwd) {
|
|
|
1313
1313
|
});
|
|
1314
1314
|
const dtsPlugin = require('rollup-plugin-dts').default({
|
|
1315
1315
|
tsconfig: tsConfigPath,
|
|
1316
|
-
compilerOptions: overrideResolvedTsOptions
|
|
1316
|
+
compilerOptions: overrideResolvedTsOptions,
|
|
1317
|
+
respectExternal
|
|
1317
1318
|
});
|
|
1318
1319
|
return dtsPlugin;
|
|
1319
1320
|
}
|
|
@@ -1399,7 +1400,7 @@ async function buildInputConfig(entry, bundleConfig, exportCondition, buildConte
|
|
|
1399
1400
|
// Each package build should be unique
|
|
1400
1401
|
// Composing above factors into a unique cache key to retrieve the memoized dts plugin with tsconfigs
|
|
1401
1402
|
const uniqueProcessId = 'dts-plugin:' + process.pid + tsConfigPath;
|
|
1402
|
-
const dtsPlugin = await memoizeDtsPluginByKey(uniqueProcessId)(tsCompilerOptions, tsConfigPath, cwd);
|
|
1403
|
+
const dtsPlugin = await memoizeDtsPluginByKey(uniqueProcessId)(tsCompilerOptions, tsConfigPath, bundleConfig.dts && bundleConfig.dts.respectExternal, cwd);
|
|
1403
1404
|
typesPlugins.push(dtsPlugin);
|
|
1404
1405
|
}
|
|
1405
1406
|
const plugins = (dts ? typesPlugins : [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunchee",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
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,14 +42,14 @@
|
|
|
42
42
|
"@rollup/plugin-replace": "^5.0.7",
|
|
43
43
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
44
44
|
"@rollup/pluginutils": "^5.1.0",
|
|
45
|
-
"@swc/core": "^1.
|
|
45
|
+
"@swc/core": "^1.7.14",
|
|
46
46
|
"@swc/helpers": "^0.5.11",
|
|
47
47
|
"arg": "^5.0.2",
|
|
48
48
|
"clean-css": "^5.3.3",
|
|
49
49
|
"magic-string": "^0.30.11",
|
|
50
50
|
"ora": "^8.0.1",
|
|
51
51
|
"pretty-bytes": "^5.6.0",
|
|
52
|
-
"rollup": "^4.19.
|
|
52
|
+
"rollup": "^4.19.2",
|
|
53
53
|
"rollup-plugin-dts": "^6.1.1",
|
|
54
54
|
"rollup-plugin-swc3": "^0.11.1",
|
|
55
55
|
"rollup-preserve-directives": "^1.1.1",
|