Comparing version 1.6.1 to 1.6.2
#!/usr/bin/env node | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var tslib = require('tslib'); | ||
var fs = _interopDefault(require('fs')); | ||
var path = _interopDefault(require('path')); | ||
var arg = _interopDefault(require('arg')); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var arg = require('arg'); | ||
var rootDir = process.cwd(); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
var arg__default = /*#__PURE__*/_interopDefaultLegacy(arg); | ||
process.cwd(); | ||
function parseCliArgs(argv) { | ||
var args; | ||
args = arg({ | ||
args = arg__default['default']({ | ||
"--cwd": String, | ||
@@ -49,3 +53,3 @@ "--output": String, | ||
var version = "1.6.1"; | ||
var version = "1.6.2"; | ||
@@ -82,4 +86,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 --target <target> build environment, use \"node\" for nodejs runtime\n --no-sourcemap disable sourcemap generation, sourcemap generation is enabled by default\n --cwd <cwd> specify current working directory\n -h, --help output usage information\n"; | ||
} | ||
entry = path.resolve(cwd || process.cwd(), source); | ||
if (!fs.existsSync(entry) || !fs.statSync(entry).isFile()) { | ||
entry = path__default['default'].resolve(cwd || process.cwd(), source); | ||
if (!fs__default['default'].existsSync(entry) || !fs__default['default'].statSync(entry).isFile()) { | ||
err = new Error('Entry file is not existed'); | ||
@@ -86,0 +90,0 @@ help(); |
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var tslib = require('tslib'); | ||
var path = require('path'); | ||
var path__default = _interopDefault(path); | ||
var rollup = require('rollup'); | ||
var fs = require('fs'); | ||
var fs__default = _interopDefault(fs); | ||
var commonjs = _interopDefault(require('rollup-plugin-commonjs')); | ||
var shebang = _interopDefault(require('rollup-plugin-preserve-shebang')); | ||
var json = _interopDefault(require('@rollup/plugin-json')); | ||
var babel = _interopDefault(require('@rollup/plugin-babel')); | ||
var nodeResolve = _interopDefault(require('@rollup/plugin-node-resolve')); | ||
var typescript = _interopDefault(require('@rollup/plugin-typescript')); | ||
var commonjs = require('@rollup/plugin-commonjs'); | ||
var shebang = require('rollup-plugin-preserve-shebang'); | ||
var json = require('@rollup/plugin-json'); | ||
var babel = require('@rollup/plugin-babel'); | ||
var nodeResolve = require('@rollup/plugin-node-resolve'); | ||
var typescript = require('@rollup/plugin-typescript'); | ||
var rollupPluginTerser = require('rollup-plugin-terser'); | ||
require('arg'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); | ||
var commonjs__default = /*#__PURE__*/_interopDefaultLegacy(commonjs); | ||
var shebang__default = /*#__PURE__*/_interopDefaultLegacy(shebang); | ||
var json__default = /*#__PURE__*/_interopDefaultLegacy(json); | ||
var babel__default = /*#__PURE__*/_interopDefaultLegacy(babel); | ||
var nodeResolve__default = /*#__PURE__*/_interopDefaultLegacy(nodeResolve); | ||
var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript); | ||
var rootDir = process.cwd(); | ||
@@ -61,12 +68,12 @@ var config = { | ||
var plugins = [ | ||
nodeResolve({ | ||
nodeResolve__default['default']({ | ||
preferBuiltins: target === 'node', | ||
extensions: ['.mjs', '.js', '.json', '.node', '.jsx'], | ||
}), | ||
commonjs({ | ||
commonjs__default['default']({ | ||
include: /node_modules\//, | ||
}), | ||
json(), | ||
shebang(), | ||
useTypescript && typescript(tslib.__assign({ tsconfig: (function () { | ||
json__default['default'](), | ||
shebang__default['default'](), | ||
useTypescript && typescript__default['default'](tslib.__assign({ tsconfig: (function () { | ||
var tsconfig = path.resolve(cwd, "tsconfig.json"); | ||
@@ -77,3 +84,3 @@ return fs.existsSync(tsconfig) ? tsconfig : undefined; | ||
}))), | ||
!useTypescript && babel({ | ||
!useTypescript && babel__default['default']({ | ||
babelHelpers: "bundled", | ||
@@ -113,3 +120,3 @@ babelrc: false, | ||
var tsconfigPath = path.resolve(cwd, "tsconfig.json"); | ||
if (fs__default.existsSync(tsconfigPath)) { | ||
if (fs__default['default'].existsSync(tsconfigPath)) { | ||
var tsconfigJSON = ts.readConfigFile(tsconfigPath, ts.sys.readFile) | ||
@@ -151,5 +158,3 @@ .config; | ||
outputConfigs = [ | ||
createOutputOptions(tslib.__assign(tslib.__assign({}, cliArgs), { file: file, | ||
format: format, | ||
useTypescript: useTypescript }), pkg) | ||
createOutputOptions(tslib.__assign(tslib.__assign({}, cliArgs), { file: file, format: format, useTypescript: useTypescript }), pkg) | ||
]; | ||
@@ -167,6 +172,6 @@ } | ||
function getPackageMeta() { | ||
var pkgFilePath = path__default.resolve(config.rootDir, 'package.json'); | ||
var pkgFilePath = path__default['default'].resolve(config.rootDir, 'package.json'); | ||
var targetPackageJson; | ||
try { | ||
targetPackageJson = JSON.parse(fs__default.readFileSync(pkgFilePath, { encoding: 'utf-8' })); | ||
targetPackageJson = JSON.parse(fs__default['default'].readFileSync(pkgFilePath, { encoding: 'utf-8' })); | ||
} | ||
@@ -188,3 +193,3 @@ catch (e) { | ||
function resolvePackagePath(pathname) { | ||
return path__default.resolve(config.rootDir, pathname); | ||
return path__default['default'].resolve(config.rootDir, pathname); | ||
} | ||
@@ -191,0 +196,0 @@ var utils = { |
{ | ||
"name": "bunchee", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -37,13 +37,13 @@ "bin": { | ||
"@rollup/plugin-babel": "5.2.1", | ||
"@rollup/plugin-commonjs": "20.0.0", | ||
"@rollup/plugin-json": "4.0.2", | ||
"@rollup/plugin-node-resolve": "11.2.1", | ||
"@rollup/plugin-typescript": "8.2.0", | ||
"@rollup/plugin-typescript": "8.2.3", | ||
"arg": "5.0.0", | ||
"babel-preset-o": "0.4.1", | ||
"rollup": "1.32.0", | ||
"rollup-plugin-commonjs": "10.1.0", | ||
"rollup": "2.55.1", | ||
"rollup-plugin-preserve-shebang": "1.0.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"tslib": "2.3.0", | ||
"typescript": "^3.9.6" | ||
"typescript": "^3.9.6 || ^4.0.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "peerDependencies": { |
@@ -63,2 +63,10 @@ # bunchee | ||
### API | ||
```js | ||
import { bundle } from 'bunchee' | ||
// options is same to CLI options | ||
await bundle(entryFilePath, options) | ||
``` | ||
#### Example Scripts | ||
@@ -65,0 +73,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29881
417
91
+ Added@rollup/plugin-commonjs@20.0.0(transitive)
+ Added@rollup/plugin-typescript@8.2.3(transitive)
+ Added@types/estree@1.0.5(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedestree-walker@2.0.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrollup@1.32.12.55.1(transitive)
+ Addedtypescript@4.9.5(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedrollup-plugin-commonjs@10.1.0
- Removed@rollup/plugin-typescript@8.2.0(transitive)
- Removedestree-walker@0.6.1(transitive)
- Removedrollup@1.32.02.79.1(transitive)
- Removedrollup-plugin-commonjs@10.1.0(transitive)
- Removedrollup-pluginutils@2.8.2(transitive)
- Removedtypescript@3.9.10(transitive)
Updatedrollup@2.55.1
Updatedtypescript@^3.9.6 || ^4.0.0