bunchee 2.0.3 → 2.0.4
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/dist/cli.js +1 -1
- package/dist/lib.js +11 -20
- package/package.json +6 -2
package/dist/cli.js
CHANGED
|
@@ -87,7 +87,7 @@ var logger = {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
var version = "2.0.
|
|
90
|
+
var version = "2.0.4";
|
|
91
91
|
|
|
92
92
|
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';
|
|
93
93
|
function help() {
|
package/dist/lib.js
CHANGED
|
@@ -99,7 +99,7 @@ function getDistPath(distPath) {
|
|
|
99
99
|
function createInputConfig(entry, pkg, options, _a) {
|
|
100
100
|
var _b;
|
|
101
101
|
var _c;
|
|
102
|
-
var tsCompilerOptions = _a.tsCompilerOptions;
|
|
102
|
+
var tsconfigPath = _a.tsconfigPath, tsCompilerOptions = _a.tsCompilerOptions;
|
|
103
103
|
var externals = [
|
|
104
104
|
pkg.peerDependencies,
|
|
105
105
|
pkg.dependencies,
|
|
@@ -162,22 +162,14 @@ function createInputConfig(entry, pkg, options, _a) {
|
|
|
162
162
|
rollupPluginSwc3.swc({
|
|
163
163
|
include: /\.(m|c)?[jt]sx?$/,
|
|
164
164
|
exclude: "node_modules",
|
|
165
|
-
tsconfig:
|
|
165
|
+
tsconfig: tsconfigPath,
|
|
166
166
|
jsc: tslib.__assign({
|
|
167
167
|
target: jscTarget,
|
|
168
168
|
loose: true,
|
|
169
169
|
externalHelpers: false,
|
|
170
170
|
parser: (_b = {
|
|
171
171
|
syntax: useTypescript ? "typescript" : "ecmascript"
|
|
172
|
-
}, _b[useTypescript ? "tsx" : "jsx"] = true, _b.privateMethod = true, _b.classPrivateProperty = true, _b.exportDefaultFrom = true, _b)
|
|
173
|
-
transform: {
|
|
174
|
-
react: {
|
|
175
|
-
runtime: [
|
|
176
|
-
"react-jsx",
|
|
177
|
-
"react-jsx-dev"
|
|
178
|
-
].includes(tsCompilerOptions === null || tsCompilerOptions === void 0 ? void 0 : tsCompilerOptions.jsx) ? "automatic" : "classic"
|
|
179
|
-
}
|
|
180
|
-
}
|
|
172
|
+
}, _b[useTypescript ? "tsx" : "jsx"] = true, _b.privateMethod = true, _b.classPrivateProperty = true, _b.exportDefaultFrom = true, _b)
|
|
181
173
|
}, minify && {
|
|
182
174
|
minify: tslib.__assign(tslib.__assign({}, minifyOptions), {
|
|
183
175
|
sourceMap: options.sourcemap
|
|
@@ -347,26 +339,27 @@ function createRollupConfig(entry, pkg, cliArgs) {
|
|
|
347
339
|
useTypescript: useTypescript
|
|
348
340
|
});
|
|
349
341
|
var tsCompilerOptions = {};
|
|
342
|
+
var tsconfigPath;
|
|
350
343
|
if (useTypescript) {
|
|
351
344
|
var ts = resolveTypescript();
|
|
352
|
-
|
|
345
|
+
tsconfigPath = path.resolve(config.rootDir, "tsconfig.json");
|
|
353
346
|
if (fs__default["default"].existsSync(tsconfigPath)) {
|
|
354
347
|
var tsconfigJSON = ts.readConfigFile(tsconfigPath, ts.sys.readFile).config;
|
|
355
348
|
tsCompilerOptions = ts.parseJsonConfigFileContent(tsconfigJSON, ts.sys, "./").options;
|
|
356
349
|
}
|
|
357
350
|
}
|
|
358
|
-
var
|
|
351
|
+
var typescriptOptions = {
|
|
352
|
+
tsconfigPath: tsconfigPath,
|
|
359
353
|
tsCompilerOptions: tsCompilerOptions
|
|
360
|
-
}
|
|
354
|
+
};
|
|
355
|
+
var inputOptions = createInputConfig(entry, pkg, options, typescriptOptions);
|
|
361
356
|
var outputExports = options.exportCondition ? getSubExportDist(pkg, options.exportCondition.export) : getExportDist(pkg);
|
|
362
357
|
var outputConfigs = outputExports.map(function(exportDist) {
|
|
363
358
|
return createOutputOptions(tslib.__assign(tslib.__assign({}, cliArgs), {
|
|
364
359
|
file: exportDist.file,
|
|
365
360
|
format: exportDist.format,
|
|
366
361
|
useTypescript: useTypescript
|
|
367
|
-
}), pkg,
|
|
368
|
-
tsCompilerOptions: tsCompilerOptions
|
|
369
|
-
});
|
|
362
|
+
}), pkg, typescriptOptions);
|
|
370
363
|
});
|
|
371
364
|
if (file) {
|
|
372
365
|
var format = (_a = outputExports[0]) === null || _a === void 0 ? void 0 : _a.format;
|
|
@@ -375,9 +368,7 @@ function createRollupConfig(entry, pkg, cliArgs) {
|
|
|
375
368
|
file: file,
|
|
376
369
|
format: cliArgs.format || format,
|
|
377
370
|
useTypescript: useTypescript
|
|
378
|
-
}), pkg,
|
|
379
|
-
tsCompilerOptions: tsCompilerOptions
|
|
380
|
-
}),
|
|
371
|
+
}), pkg, typescriptOptions),
|
|
381
372
|
];
|
|
382
373
|
}
|
|
383
374
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunchee",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "zero config bundler for js/ts/jsx libraries",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bunchee": "./dist/cli.js"
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"*.md"
|
|
33
33
|
],
|
|
34
34
|
"author": "huozhi (github.com/huozhi)",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/huozhi/bunchee.git"
|
|
38
|
+
},
|
|
35
39
|
"license": "MIT",
|
|
36
40
|
"dependencies": {
|
|
37
41
|
"@rollup/plugin-commonjs": "22.0.2",
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
"arg": "5.0.0",
|
|
43
47
|
"rollup": "2.74.1",
|
|
44
48
|
"rollup-plugin-preserve-shebang": "1.0.1",
|
|
45
|
-
"rollup-plugin-swc3": "0.
|
|
49
|
+
"rollup-plugin-swc3": "0.5.0",
|
|
46
50
|
"tslib": "2.4.0"
|
|
47
51
|
},
|
|
48
52
|
"peerDependencies": {
|