Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunchee

Package Overview
Dependencies
Maintainers
0
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunchee - npm Package Compare versions

Comparing version 5.5.1 to 5.6.0

156

dist/bin/cli.js
#!/usr/bin/env node
var path = require('path');
var arg = require('arg');
var yargs = require('yargs');
var helpers = require('yargs/helpers');
var perf_hooks = require('perf_hooks');

@@ -15,3 +16,3 @@ var fs = require('fs');

var path__default = /*#__PURE__*/_interopDefault(path);
var arg__default = /*#__PURE__*/_interopDefault(arg);
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
var fs__default = /*#__PURE__*/_interopDefault(fs);

@@ -528,3 +529,3 @@ var fsp__default = /*#__PURE__*/_interopDefault(fsp);

var version = "5.5.1";
var version = "5.6.0";

@@ -989,53 +990,86 @@ function relativify(path) {

}
function parseCliArgs(argv) {
let args;
args = arg__default.default({
'--cwd': String,
'--no-dts': Boolean,
'--output': String,
'--format': String,
'--watch': Boolean,
'--minify': Boolean,
'--help': Boolean,
'--version': Boolean,
'--runtime': String,
'--target': String,
'--sourcemap': Boolean,
'--env': String,
'--external': String,
'--no-external': Boolean,
'--no-clean': Boolean,
'--prepare': Boolean,
'--tsconfig': String,
'--dts-bundle': Boolean,
'-h': '--help',
'-v': '--version',
'-w': '--watch',
'-o': '--output',
'-f': '--format',
'-m': '--minify'
}, {
permissive: true,
argv
});
async function parseCliArgs(argv) {
const args = await yargs__default.default(helpers.hideBin(argv)).option('cwd', {
type: 'string',
description: 'specify current working directory'
}).option('dts', {
coerce (arg) {
return arg === false ? false : undefined;
},
description: 'do not generate types'
}).option('clean', {
coerce (arg) {
return arg === false ? false : undefined;
},
description: 'do not clean dist folder before building'
}).option('output', {
type: 'string',
alias: 'o',
description: 'specify output filename'
}).option('format', {
type: 'string',
alias: 'f',
default: 'esm',
description: 'type of output (esm, amd, cjs, iife, umd, system)'
}).option('watch', {
type: 'boolean',
alias: 'w',
description: 'watch src files changes'
}).option('minify', {
type: 'boolean',
alias: 'm',
description: 'compress output'
}).option('help', {
type: 'boolean',
alias: 'h',
description: 'output usage information'
}).option('runtime', {
type: 'string',
default: 'browser',
description: 'build runtime (nodejs, browser)'
}).option('target', {
type: 'string',
description: 'js features target: swc target es versions'
}).option('sourcemap', {
type: 'boolean',
default: false,
description: 'enable sourcemap generation'
}).option('env', {
type: 'string',
description: 'inlined process env variables, separate by comma'
}).option('external', {
coerce (arg) {
return typeof arg === 'string' || typeof arg === 'boolean' ? arg : undefined;
},
description: 'specify an external dependency, separate by comma'
}).option('prepare', {
type: 'boolean',
description: 'auto configure package.json exports for building'
}).option('tsconfig', {
type: 'string',
description: 'path to tsconfig file'
}).option('dts-bundle', {
type: 'boolean',
description: 'bundle type declaration files'
}).version(version).help('help', 'output usage information').showHelpOnFail(true).parse();
const source = args._[0];
const parsedArgs = {
source,
format: args['--format'],
file: args['--output'],
watch: args['--watch'],
minify: args['--minify'],
sourcemap: !!args['--sourcemap'],
cwd: args['--cwd'],
dts: args['--no-dts'] ? false : undefined,
dtsBundle: args['--dts-bundle'],
help: args['--help'],
version: args['--version'],
runtime: args['--runtime'],
target: args['--target'],
external: !!args['--no-external'] ? null : args['--external'],
clean: !args['--no-clean'],
env: args['--env'],
prepare: !!args['--prepare'],
tsconfig: args['--tsconfig']
format: args['format'],
file: args['output'],
watch: args['watch'],
minify: args['minify'],
sourcemap: !!args['sourcemap'],
cwd: args['cwd'],
dts: args['dts'] === false ? false : undefined,
dtsBundle: args['dts-bundle'],
help: args['help'],
runtime: args['runtime'],
target: args['target'],
// no-external is a boolean flag, turning external to `false`
external: args['external'] === false ? null : args['external'],
clean: args['clean'] !== false,
env: args['env'],
prepare: !!args['prepare'],
tsconfig: args['tsconfig']
};

@@ -1066,8 +1100,2 @@ return parsedArgs;

};
if (args.version) {
return logger.log(version);
}
if (args.help) {
return help();
}
if (args.prepare) {

@@ -1080,6 +1108,12 @@ return await prepare(cwd);

const { default: ora } = await import('ora');
const oraInstance = ora({
const oraInstance = process.stdout.isTTY ? ora({
text: 'Building...\n\n',
color: 'green'
});
}) : {
start: ()=>{},
stop: ()=>{},
clear: ()=>{},
stopAndPersist: ()=>{},
isSpinning: false
};
const spinner = {

@@ -1164,3 +1198,3 @@ start: startSpinner,

try {
params = parseCliArgs(process.argv.slice(2));
params = await parseCliArgs(process.argv);
} catch (err) {

@@ -1170,3 +1204,3 @@ error = err;

if (error || !params) {
if (!error) help();
// if (!error) help()
return exit(error);

@@ -1173,0 +1207,0 @@ }

@@ -41,3 +41,5 @@ import { JscTarget } from '@swc/types';

typings?: string;
browserslist?: BrowserslistConfig;
};
type BrowserslistConfig = string | string[] | Record<string, string>;

@@ -44,0 +46,0 @@ declare function bundle(cliEntryPath: string, { cwd: _cwd, ...options }?: BundleConfig): Promise<void>;

{
"name": "bunchee",
"version": "5.5.1",
"version": "5.6.0",
"description": "zero config bundler for js/ts/jsx libraries",

@@ -47,3 +47,2 @@ "bin": "./dist/bin/cli.js",

"@swc/helpers": "^0.5.11",
"arg": "^5.0.2",
"clean-css": "^5.3.3",

@@ -57,3 +56,4 @@ "magic-string": "^0.30.11",

"rollup-preserve-directives": "^1.1.2",
"tslib": "^2.7.0"
"tslib": "^2.7.0",
"yargs": "^17.7.2"
},

@@ -79,2 +79,3 @@ "peerDependencies": {

"@types/node": "^20.4.1",
"@types/yargs": "^17.0.33",
"bunchee": "link:./",

@@ -81,0 +82,0 @@ "cross-env": "^7.0.3",

@@ -473,3 +473,17 @@ # bunchee

If you specify `target` option in `tsconfig.json`, then you don't have to pass it again through CLI.
To target a range of browsers, you can use the `browserslist` field in `package.json`, bunchee will use it to determine the target browsers for the output bundle.
For example:
```json
{
"browserslist": [
"last 1 version",
"> 1%",
"maintained node versions",
"not dead"
]
}
```
#### Package lint

@@ -476,0 +490,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc