bunchee 6.8.0 → 6.8.1
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/README.md +0 -4
- package/dist/bin/cli.js +18 -20
- package/dist/index.js +3 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -323,10 +323,6 @@ TypeScript-Go (`@typescript/native-preview`) is a high-performance, Go-based imp
|
|
|
323
323
|
|
|
324
324
|
To use TypeScript-Go for type generation, use the `--tsgo` flag:
|
|
325
325
|
|
|
326
|
-
```sh
|
|
327
|
-
bunchee --tsgo
|
|
328
|
-
```
|
|
329
|
-
|
|
330
326
|
**Note**: This requires `@typescript/native-preview` to be installed as a dev dependency. If it's not installed, bunchee will exit with an error.
|
|
331
327
|
|
|
332
328
|
```sh
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var path = require('path');
|
|
3
|
+
var module$1 = require('module');
|
|
3
4
|
var yargs = require('yargs');
|
|
4
5
|
var helpers = require('yargs/helpers');
|
|
5
6
|
var perf_hooks = require('perf_hooks');
|
|
@@ -8,7 +9,6 @@ var fsp = require('fs/promises');
|
|
|
8
9
|
var require$$0 = require('tty');
|
|
9
10
|
var picomatch = require('picomatch');
|
|
10
11
|
var index_js = require('../index.js');
|
|
11
|
-
require('module');
|
|
12
12
|
var tinyglobby = require('tinyglobby');
|
|
13
13
|
var prettyBytes = require('pretty-bytes');
|
|
14
14
|
var nanospinner = require('nanospinner');
|
|
@@ -437,13 +437,13 @@ function validateFilesField(packageJson) {
|
|
|
437
437
|
'*'
|
|
438
438
|
];
|
|
439
439
|
const exportsField = packageJson.exports || {};
|
|
440
|
-
const resolveExportsPaths = (exports
|
|
440
|
+
const resolveExportsPaths = (exports)=>{
|
|
441
441
|
const paths = [];
|
|
442
|
-
if (typeof exports
|
|
443
|
-
paths.push(exports
|
|
444
|
-
} else if (typeof exports
|
|
445
|
-
for(const key in exports
|
|
446
|
-
paths.push(...resolveExportsPaths(exports
|
|
442
|
+
if (typeof exports === 'string') {
|
|
443
|
+
paths.push(exports);
|
|
444
|
+
} else if (typeof exports === 'object') {
|
|
445
|
+
for(const key in exports){
|
|
446
|
+
paths.push(...resolveExportsPaths(exports[key]));
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
return paths;
|
|
@@ -470,7 +470,7 @@ function validateFilesField(packageJson) {
|
|
|
470
470
|
return state;
|
|
471
471
|
}
|
|
472
472
|
function lint$1(pkg) {
|
|
473
|
-
const { name, main, exports
|
|
473
|
+
const { name, main, exports } = pkg;
|
|
474
474
|
const isESM = isESModulePackage(pkg.type);
|
|
475
475
|
const parsedExports = parseExports(pkg);
|
|
476
476
|
if (!name) {
|
|
@@ -500,12 +500,12 @@ function lint$1(pkg) {
|
|
|
500
500
|
};
|
|
501
501
|
// Validate ESM package
|
|
502
502
|
if (isESM) {
|
|
503
|
-
if (exports
|
|
504
|
-
if (typeof exports
|
|
505
|
-
if (hasCjsExtension(exports
|
|
503
|
+
if (exports) {
|
|
504
|
+
if (typeof exports === 'string') {
|
|
505
|
+
if (hasCjsExtension(exports)) {
|
|
506
506
|
exportsState.badMainExport = true;
|
|
507
507
|
}
|
|
508
|
-
} else if (typeof exports
|
|
508
|
+
} else if (typeof exports !== 'object') {
|
|
509
509
|
exportsState.invalidExportsFieldType = true;
|
|
510
510
|
} else {
|
|
511
511
|
parsedExports.forEach((outputPairs)=>{
|
|
@@ -548,12 +548,12 @@ function lint$1(pkg) {
|
|
|
548
548
|
if (main && path__default.default.extname(main) === '.mjs') {
|
|
549
549
|
exportsState.badMainExtension = true;
|
|
550
550
|
}
|
|
551
|
-
if (exports
|
|
552
|
-
if (typeof exports
|
|
553
|
-
if (path__default.default.extname(exports
|
|
551
|
+
if (exports) {
|
|
552
|
+
if (typeof exports === 'string') {
|
|
553
|
+
if (path__default.default.extname(exports) === '.mjs') {
|
|
554
554
|
exportsState.badMainExport = true;
|
|
555
555
|
}
|
|
556
|
-
} else if (typeof exports
|
|
556
|
+
} else if (typeof exports !== 'object') {
|
|
557
557
|
exportsState.invalidExportsFieldType = true;
|
|
558
558
|
} else {
|
|
559
559
|
parsedExports.forEach((outputPairs)=>{
|
|
@@ -647,7 +647,7 @@ function lint$1(pkg) {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
var version = "6.8.
|
|
650
|
+
var version = "6.8.1";
|
|
651
651
|
|
|
652
652
|
async function writeDefaultTsconfig(tsConfigPath, useTsGo) {
|
|
653
653
|
await fs.promises.writeFile(tsConfigPath, JSON.stringify(DEFAULT_TS_CONFIG, null, 2), 'utf-8');
|
|
@@ -1312,9 +1312,7 @@ async function run(args) {
|
|
|
1312
1312
|
if (args.tsgo) {
|
|
1313
1313
|
try {
|
|
1314
1314
|
require.resolve('@typescript/native-preview', {
|
|
1315
|
-
paths:
|
|
1316
|
-
cwd
|
|
1317
|
-
]
|
|
1315
|
+
paths: module$1.Module._nodeModulePaths(cwd)
|
|
1318
1316
|
});
|
|
1319
1317
|
} catch {
|
|
1320
1318
|
exit('--tsgo flag was specified but @typescript/native-preview is not installed. Please install it as a dev dependency: pnpm add -D @typescript/native-preview');
|
package/dist/index.js
CHANGED
|
@@ -1043,9 +1043,7 @@ function resolveTsGo(cwd) {
|
|
|
1043
1043
|
// Bun does not yet support the `Module` class properly.
|
|
1044
1044
|
if (typeof (m == null ? void 0 : m.require) === 'undefined') {
|
|
1045
1045
|
const tsgoPath = require.resolve('@typescript/native-preview', {
|
|
1046
|
-
paths:
|
|
1047
|
-
cwd
|
|
1048
|
-
]
|
|
1046
|
+
paths: module$1.Module._nodeModulePaths(cwd)
|
|
1049
1047
|
});
|
|
1050
1048
|
tsgo = require(tsgoPath);
|
|
1051
1049
|
} else {
|
|
@@ -1077,9 +1075,7 @@ function resolveTypescript(cwd, useTsGo) {
|
|
|
1077
1075
|
// Bun does not yet support the `Module` class properly.
|
|
1078
1076
|
if (typeof (m == null ? void 0 : m.require) === 'undefined') {
|
|
1079
1077
|
const tsPath = require.resolve('typescript', {
|
|
1080
|
-
paths:
|
|
1081
|
-
cwd
|
|
1082
|
-
]
|
|
1078
|
+
paths: module$1.Module._nodeModulePaths(cwd)
|
|
1083
1079
|
});
|
|
1084
1080
|
ts = require(tsPath);
|
|
1085
1081
|
} else {
|
|
@@ -1681,9 +1677,7 @@ async function createDtsPlugin(tsCompilerOptions, tsConfigPath, respectExternal,
|
|
|
1681
1677
|
try {
|
|
1682
1678
|
// First, try to resolve typescript to get its path
|
|
1683
1679
|
const tsPath = require.resolve('typescript', {
|
|
1684
|
-
paths:
|
|
1685
|
-
cwd
|
|
1686
|
-
]
|
|
1680
|
+
paths: module$1.Module._nodeModulePaths(cwd)
|
|
1687
1681
|
});
|
|
1688
1682
|
// Make ts-go available as 'typescript' for rollup-plugin-dts
|
|
1689
1683
|
// This overrides the module cache so rollup-plugin-dts will use ts-go
|