Comparing version
@@ -24,2 +24,3 @@ #!/usr/bin/env node | ||
"--version": Boolean, | ||
"--runtime": String, | ||
"--target": String, | ||
@@ -52,2 +53,3 @@ "--sourcemap": Boolean, | ||
version: args["--version"], | ||
runtime: args["--runtime"], | ||
target: args["--target"], | ||
@@ -90,5 +92,5 @@ external: args["--external"] | ||
var version = "2.0.0-beta.3"; | ||
var version = "2.0.0-beta.4"; | ||
var helpMessage = '\nUsage: bunchee [options]\n\nOptions:\n -v, --version output the version number\n -w, --watch watch src files changes\n -m, --minify compress output. false by default\n -o, --output <file> specify output filename\n -f, --format <format> specify bundle type: "esm", "cjs", "umd". "esm" by default\n -e, --external <mod> specify an external dependency\n --target <target> build environment, use "node" for nodejs runtime\n --sourcemap enable sourcemap generation, sourcemap generation is disabled by default\n --cwd <cwd> specify current working directory\n -h, --help output usage information\n'; | ||
var helpMessage = '\nUsage: bunchee [options]\n\nOptions:\n -v, --version output the version number\n -w, --watch watch src files changes\n -m, --minify compress output. false by default\n -o, --output <file> specify output filename\n -f, --format <format> specify bundle type: "esm", "cjs", "umd". "esm" by default\n -e, --external <mod> specify an external dependency\n --target <target> js features target: swc target es versions. "es5" by default\n --runtime <runtime> build runtime: "nodejs", "browser". "browser" by default\n --sourcemap enable sourcemap generation, false by default\n --cwd <cwd> specify current working directory\n -h, --help output usage information\n'; | ||
function help() { | ||
@@ -99,11 +101,11 @@ console.log(helpMessage); | ||
logger.error(err); | ||
process.exit(2); | ||
process.exit(1); | ||
} | ||
function run(args) { | ||
return tslib.__awaiter(this, void 0, void 0, function() { | ||
var source, format, watch, minify, sourcemap, target, cwd, file, outputConfig, entry, bundle, err_1; | ||
var source, format, watch, minify, sourcemap, target, runtime, cwd, file, outputConfig, entry, bundle, err_1; | ||
return tslib.__generator(this, function(_a) { | ||
switch(_a.label){ | ||
case 0: | ||
source = args.source, format = args.format, watch = args.watch, minify = args.minify, sourcemap = args.sourcemap, target = args.target; | ||
source = args.source, format = args.format, watch = args.watch, minify = args.minify, sourcemap = args.sourcemap, target = args.target, runtime = args.runtime; | ||
cwd = args.cwd || process.cwd(); | ||
@@ -116,2 +118,3 @@ file = args.file ? path__default["default"].resolve(cwd, args.file) : args.file; | ||
target: target, | ||
runtime: runtime, | ||
external: args.external || [], | ||
@@ -135,3 +138,3 @@ watch: !!watch, | ||
entry = source ? path__default["default"].resolve(cwd, source) : ""; | ||
bundle = require(".").bundle; | ||
bundle = require("./lib").bundle; | ||
_a.label = 1; | ||
@@ -138,0 +141,0 @@ case 1: |
import type { PackageMetadata, BuncheeRollupConfig, CliArgs } from './types'; | ||
declare function createRollupConfig(entry: string, pkg: PackageMetadata, cliArgs: CliArgs, entryExport?: string): BuncheeRollupConfig; | ||
declare function createRollupConfig(entry: string, pkg: PackageMetadata, cliArgs: CliArgs): BuncheeRollupConfig; | ||
export default createRollupConfig; |
@@ -0,1 +1,2 @@ | ||
import type { JscTarget } from '@swc/core'; | ||
import type { InputOptions, OutputOptions, RollupOptions } from 'rollup'; | ||
@@ -8,7 +9,9 @@ declare type ExportType = 'require' | 'export' | 'default' | string; | ||
external?: string[]; | ||
target?: string; | ||
runtime?: string; | ||
exportCondition?: { | ||
source: string; | ||
name: string; | ||
export: ExportCondition; | ||
}; | ||
}; | ||
declare type BuildConfig = CommonConfig & { | ||
entry: string | Record<string, string>; | ||
}; | ||
declare type PackageMetadata = { | ||
@@ -25,3 +28,2 @@ name?: string; | ||
typings?: string; | ||
bunchee?: BuildConfig; | ||
}; | ||
@@ -37,2 +39,3 @@ declare type ExportCondition = string | Record<ExportType, string>; | ||
cwd?: string; | ||
target?: JscTarget; | ||
}; | ||
@@ -39,0 +42,0 @@ declare type BundleOptions = CliArgs & { |
@@ -14,2 +14,3 @@ import type { PackageMetadata } from './types'; | ||
version: any; | ||
runtime: any; | ||
target: any; | ||
@@ -16,0 +17,0 @@ external: any; |
{ | ||
"name": "bunchee", | ||
"version": "2.0.0-beta.3", | ||
"version": "2.0.0-beta.4", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -8,4 +8,4 @@ "bin": { | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/src/index.d.ts", | ||
"main": "./dist/lib.js", | ||
"types": "./dist/lib.d.ts", | ||
"scripts": { | ||
@@ -15,8 +15,7 @@ "test": "jest --env node", | ||
"clean": "rm -rf ./dist", | ||
"types": "tsc --declaration --declarationDir dist --emitDeclarationOnly", | ||
"typecheck": "tsc --noEmit", | ||
"prepublishOnly": "yarn clean && yarn build && chmod +x dist/cli.js && yarn test", | ||
"build:cli": "tsx src/cli.ts src/cli.ts --target node -f cjs -o dist/cli.js", | ||
"build:main": "tsx src/cli.ts src/index.ts --target node -f cjs", | ||
"build": "yarn build:main && yarn build:cli && yarn types" | ||
"prepublishOnly": "yarn clean && yarn build && chmod +x ./dist/cli.js && yarn test", | ||
"build:cli": "tsx ./cli.ts ./cli.ts --runtime node -f cjs -o ./dist/cli.js", | ||
"build:main": "tsx ./cli.ts ./lib.ts --runtime node -f cjs", | ||
"build": "yarn build:main && yarn build:cli" | ||
}, | ||
@@ -40,6 +39,6 @@ "type": "commonjs", | ||
"dependencies": { | ||
"@rollup/plugin-commonjs": "21.1.0", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@rollup/plugin-typescript": "8.3.4", | ||
"@rollup/plugin-typescript": "8.4.0", | ||
"@swc/core": "^1.2.244", | ||
@@ -49,4 +48,4 @@ "arg": "5.0.0", | ||
"rollup-plugin-preserve-shebang": "1.0.1", | ||
"rollup-plugin-swc3": "0.3.0", | ||
"tslib": "2.3.0" | ||
"rollup-plugin-swc3": "0.4.1", | ||
"tslib": "2.4.0" | ||
}, | ||
@@ -62,6 +61,14 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"jest": "27.0.6", | ||
"jest": "29.0.1", | ||
"tsx": "3.4.3", | ||
"typescript": "4.8.2" | ||
}, | ||
"jest": { | ||
"moduleDirectories": [ | ||
"node_modules" | ||
], | ||
"moduleNameMapper": { | ||
"bunchee": "<rootDir>/dist/lib.js" | ||
} | ||
} | ||
} |
@@ -78,4 +78,5 @@ # bunchee | ||
-h, --help output usage information | ||
--target <target> build environment, use "node" for nodejs runtime | ||
--sourcemap enable sourcemap generation, sourcemap generation is disabled by default | ||
--target <target> js features target: swc target es versions. "es5" by default | ||
--runtime <runtime> build runtime: "nodejs", "browser". "browser" by default | ||
--sourcemap enable sourcemap generation, false by default | ||
--cwd <cwd> specify current working directory | ||
@@ -82,0 +83,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
116
0.87%30856
-2.34%11
-38.89%754
-4.19%1
Infinity%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated