Comparing version 4.2.6 to 4.2.7
@@ -118,3 +118,3 @@ #!/usr/bin/env node | ||
var version = "4.2.6"; | ||
var version = "4.2.7"; | ||
@@ -121,0 +121,0 @@ const helpMessage = ` |
@@ -167,6 +167,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
} | ||
return { | ||
code, | ||
map: null | ||
}; | ||
return null; | ||
} | ||
@@ -213,4 +210,3 @@ } | ||
'THIS_IS_UNDEFINED', | ||
'INVALID_ANNOTATION', | ||
'SOURCEMAP_BROKEN' | ||
'INVALID_ANNOTATION' | ||
]); | ||
@@ -379,7 +375,7 @@ | ||
function constructFullExportCondition(exportCondition, packageType) { | ||
const isEsmPkg = isESModulePackage(packageType); | ||
let fullExportCond; | ||
if (typeof exportCondition === 'string') { | ||
const exportType = getExportTypeFromFile(exportCondition, packageType); | ||
fullExportCond = { | ||
[isEsmPkg ? 'import' : 'require']: exportCondition | ||
[exportType]: exportCondition | ||
}; | ||
@@ -408,2 +404,4 @@ } else { | ||
function findExport(exportPath, exportCondition, paths, packageType) { | ||
// Skip `types` field, it cannot be the entry point | ||
if (exportPath === 'types') return; | ||
if (isExportLike(exportCondition)) { | ||
@@ -647,2 +645,9 @@ const fullExportCondition = constructFullExportCondition(exportCondition, packageType); | ||
} | ||
function getExportTypeFromFile(filename, pkgType) { | ||
const isESModule = isESModulePackage(pkgType); | ||
const isCjsExt = filename.endsWith('.cjs'); | ||
const isEsmExt = filename.endsWith('.mjs'); | ||
const exportType = isEsmExt ? 'import' : isCjsExt ? 'require' : isESModule ? 'import' : 'require'; | ||
return exportType; | ||
} | ||
@@ -735,19 +740,2 @@ const swcMinifyOptions = { | ||
]; | ||
const baseResolvedTsOptions = { | ||
declaration: true, | ||
noEmit: false, | ||
noEmitOnError: true, | ||
emitDeclarationOnly: true, | ||
checkJs: false, | ||
declarationMap: false, | ||
skipLibCheck: true, | ||
preserveSymlinks: false, | ||
// disable incremental build | ||
incremental: false, | ||
// use default tsBuildInfoFile value | ||
tsBuildInfoFile: '.tsbuildinfo', | ||
target: 'esnext', | ||
module: 'esnext', | ||
jsx: tsCompilerOptions.jsx || 'react-jsx' | ||
}; | ||
const typesPlugins = [ | ||
@@ -760,12 +748,23 @@ ...commonPlugins, | ||
if (useTypescript) { | ||
const overrideResolvedTsOptions = { | ||
declaration: true, | ||
noEmit: false, | ||
noEmitOnError: true, | ||
emitDeclarationOnly: true, | ||
checkJs: false, | ||
declarationMap: false, | ||
skipLibCheck: true, | ||
preserveSymlinks: false, | ||
target: 'esnext', | ||
module: 'esnext', | ||
jsx: tsCompilerOptions.jsx || 'react-jsx' | ||
}; | ||
const mergedOptions = { | ||
...baseResolvedTsOptions, | ||
...tsCompilerOptions | ||
...tsCompilerOptions, | ||
...overrideResolvedTsOptions | ||
}; | ||
// error TS5074: Option '--incremental' can only be specified using tsconfig, emitting to single | ||
// file or when option '--tsBuildInfoFile' is specified. | ||
if (!mergedOptions.incremental) { | ||
delete mergedOptions.incremental; | ||
delete mergedOptions.tsBuildInfoFile; | ||
} | ||
delete mergedOptions.incremental; | ||
delete mergedOptions.tsBuildInfoFile; | ||
const dtsPlugin = require('rollup-plugin-dts').default({ | ||
@@ -1009,8 +1008,4 @@ tsconfig: undefined, | ||
]); | ||
const isESModule = isESModulePackage(pkg.type); | ||
const binExportPaths = binPairs.reduce((acc, [binName, binDistPath])=>{ | ||
const ext = path.extname(binDistPath).slice(1); | ||
const isCjsExt = ext === 'cjs'; | ||
const isEsmExt = ext === 'mjs'; | ||
const exportType = isEsmExt ? 'import' : isCjsExt ? 'require' : isESModule ? 'import' : 'require'; | ||
const exportType = getExportTypeFromFile(binDistPath, pkg.type); | ||
acc[binName] = { | ||
@@ -1190,3 +1185,2 @@ [exportType]: binDistPath | ||
} else { | ||
tsConfigPath = undefined; | ||
return null; | ||
@@ -1193,0 +1187,0 @@ } |
{ | ||
"name": "bunchee", | ||
"version": "4.2.6", | ||
"version": "4.2.7", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -65,3 +65,3 @@ "bin": "./dist/bin/cli.js", | ||
"rollup-plugin-swc3": "^0.11.0", | ||
"rollup-preserve-directives": "^1.1.0", | ||
"rollup-preserve-directives": "^1.1.1", | ||
"tslib": "^2.6.2" | ||
@@ -68,0 +68,0 @@ }, |
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
77883
1633