Comparing version 2.0.1 to 2.0.2
@@ -90,3 +90,3 @@ #!/usr/bin/env node | ||
var version = "2.0.1"; | ||
var version = "2.0.2"; | ||
@@ -93,0 +93,0 @@ 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'; |
@@ -99,5 +99,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
} | ||
function createInputConfig(entry, pkg, options) { | ||
var _a; | ||
function createInputConfig(entry, pkg, options, _a) { | ||
var _b; | ||
var _c; | ||
var tsCompilerOptions = _a.tsCompilerOptions; | ||
var externals = [ | ||
@@ -113,3 +114,3 @@ pkg.peerDependencies, | ||
return a.concat(b); | ||
}, []).concat(((_b = options.external) !== null && _b !== void 0 ? _b : []).concat(pkg.name ? [ | ||
}, []).concat(((_c = options.external) !== null && _c !== void 0 ? _c : []).concat(pkg.name ? [ | ||
pkg.name | ||
@@ -153,3 +154,3 @@ ] : [])); | ||
typescript: resolveTypescript(), | ||
jsx: "react", | ||
jsx: (tsCompilerOptions === null || tsCompilerOptions === void 0 ? void 0 : tsCompilerOptions.jsx) || "react", | ||
module: "ES6", | ||
@@ -172,5 +173,13 @@ target: jscTarget, | ||
externalHelpers: false, | ||
parser: (_a = { | ||
parser: (_b = { | ||
syntax: useTypescript ? "typescript" : "ecmascript" | ||
}, _a[useTypescript ? "tsx" : "jsx"] = true, _a.privateMethod = true, _a.classPrivateProperty = true, _a.exportDefaultFrom = true, _a) | ||
}, _b[useTypescript ? "tsx" : "jsx"] = true, _b.privateMethod = true, _b.classPrivateProperty = true, _b.exportDefaultFrom = true, _b), | ||
transform: { | ||
react: { | ||
runtime: [ | ||
"react-jsx", | ||
"react-jsx-dev" | ||
].includes(tsCompilerOptions === null || tsCompilerOptions === void 0 ? void 0 : tsCompilerOptions.jsx) ? "automatic" : "classic" | ||
} | ||
} | ||
}, minify && { | ||
@@ -212,13 +221,5 @@ minify: tslib.__assign(tslib.__assign({}, minifyOptions), { | ||
} | ||
function createOutputOptions(options, pkg) { | ||
var format = options.format, useTypescript = options.useTypescript; | ||
var tsCompilerOptions = {}; | ||
if (useTypescript) { | ||
var ts = resolveTypescript(); | ||
var tsconfigPath = path.resolve(config.rootDir, "tsconfig.json"); | ||
if (fs__default["default"].existsSync(tsconfigPath)) { | ||
var tsconfigJSON = ts.readConfigFile(tsconfigPath, ts.sys.readFile).config; | ||
tsCompilerOptions = ts.parseJsonConfigFileContent(tsconfigJSON, ts.sys, "./").options; | ||
} | ||
} | ||
function createOutputOptions(options, pkg, _a) { | ||
var tsCompilerOptions = _a.tsCompilerOptions; | ||
var format = options.format; | ||
var exportPaths = getExportPaths(pkg); | ||
@@ -353,3 +354,14 @@ var useEsModuleMark = Boolean(tsCompilerOptions.esModuleInterop || exportPaths.main && exportPaths.module); | ||
}); | ||
var inputOptions = createInputConfig(entry, pkg, options); | ||
var tsCompilerOptions = {}; | ||
if (useTypescript) { | ||
var ts = resolveTypescript(); | ||
var tsconfigPath = path.resolve(config.rootDir, "tsconfig.json"); | ||
if (fs__default["default"].existsSync(tsconfigPath)) { | ||
var tsconfigJSON = ts.readConfigFile(tsconfigPath, ts.sys.readFile).config; | ||
tsCompilerOptions = ts.parseJsonConfigFileContent(tsconfigJSON, ts.sys, "./").options; | ||
} | ||
} | ||
var inputOptions = createInputConfig(entry, pkg, options, { | ||
tsCompilerOptions: tsCompilerOptions | ||
}); | ||
var outputExports = options.exportCondition ? getSubExportDist(pkg, options.exportCondition.export) : getExportDist(pkg); | ||
@@ -361,3 +373,5 @@ var outputConfigs = outputExports.map(function(exportDist) { | ||
useTypescript: useTypescript | ||
}), pkg); | ||
}), pkg, { | ||
tsCompilerOptions: tsCompilerOptions | ||
}); | ||
}); | ||
@@ -371,3 +385,5 @@ if (file) { | ||
useTypescript: useTypescript | ||
}), pkg), | ||
}), pkg, { | ||
tsCompilerOptions: tsCompilerOptions | ||
}), | ||
]; | ||
@@ -378,3 +394,3 @@ } | ||
output: outputConfigs, | ||
exportName: ((_b = options.exportCondition) === null || _b === void 0 ? void 0 : _b.name) || pkg.name | ||
exportName: ((_b = options.exportCondition) === null || _b === void 0 ? void 0 : _b.name) || "." | ||
}; | ||
@@ -465,3 +481,3 @@ } | ||
function getExportPath(pkg, exportName) { | ||
var name = pkg.name || "<package>"; | ||
var name = pkg.name || path.basename(config.rootDir); | ||
if (exportName === "." || !exportName) return name; | ||
@@ -468,0 +484,0 @@ return path.join(name, exportName); |
{ | ||
"name": "bunchee", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -58,2 +58,3 @@ "bin": { | ||
"jest": "29.0.1", | ||
"react": "18.2.0", | ||
"tsx": "3.4.3", | ||
@@ -60,0 +61,0 @@ "typescript": "4.8.2" |
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
34752
814
4